Some Bits: Nelson's log

Postcards AI hacking

Just finished a big AI coding project, my travel postcards. I’m very happy with how it turned out. (I’m talking about AI code but this post is written entirely by me.)

I’d originally created a simple thread unroller for my Mastodon posts using an old version of Claude Code and then later Jules + Gemini Flash 3.5. It worked well on a relatively simple task, the Mastodon threads I create are very tidy.

But I’ve been tweeting about trips since 2009 and not always so organized. So I set Claude + Opus 5 to work on a recovery task, to collect all the old travel threads. It did very well, way better than I would have done on my own. I never would have done all this work myself.

(An aside: AI coding is very divisive. One argument is “it doesn’t work very well”. I think that’s just wrong. AI coding can work very well indeed. This experience with Opus 5 was really good, it’s a major improvement over the older models. And this task is well suited to AI. I don’t really care much about the code quality. And it’s easy to inspect the final output and determine if it’s working.)

Interesting work we did

The basic recovery project was pretty simple: take some old Storify posts and my Twitter archive export and tell the AI to write a program to find and organize all the trip tweets.

I gave it a pretty open-ended brief for this and didn’t suggest how to do it. It tried out various heuristics and tested them against one known-good output I already had hand edited. It finally settled on a combination of the text using travel words and city names plus looking at timestamps on tweets for when I was apparently in a different time zone. I really appreciated its proactive autonomy, both for coming up with heuristics and for validating them.

Recovering photos was a harder problem. Twitter’s export archive doesn’t contain full resolution images. And for older tweets there isn’t an image at all, sometimes all you have is a dead twitpic URL.

I would have given up, just accepted the low-res photos and lost images. The AI was much more persistent and found hundreds of photos for me. Some of the strategies it came up with:

  • Finding Flickr photos in my Flickr data export by realizing that the URLs in the tweets were base-58 encoded versions of the IDs in the export.
  • Finding Twitpic and Yfrog images on the Wayback Machine. (Sorry Brewster, y’all throttled me a lot.)
  • Matching low-res photos from the recovery process with higher res originals in my Google Photos export using image-similarity heuristics that it chose and validated itself.
  • Matching cropped photos from the recovery process into uncropped originals on Google Photos by guessing what crop I applied and matching similar images. This was slow but it worked and helped recover a bunch of photos from India.
  • Where no image from Twitter was available, finding photos in Google Photos based solely on timestamps.
  • The only thing it didn’t try was matching my tweet text (“picture of my ice cream!”) to a semantic analysis of the images (identifying pictures of ice cream). I know the AIs are capable of doing vision but I didn’t ask it to and it didn’t volunteer.

A key part of working with AI is knowing when you can just trust its output, when you can have it effectively validate its own output, and when you need to step in and validate it yourself. I spent a lot of time skimming over the output pages it was generating making sure they were plausible. And in several places I had it write tools to let me do editorial work myself, like picking photos when they were ambiguous.

Some AI things that worked

Early on Claude was giving me markdown files to hand-edit to make some editorial decisions. That’s tedious, so I asked the agent to write a basic Web GUI tool that was a custom editor for the task. That was so easy and productive I ended up having it build several tools. times. I would never ever write a throwaway task-specific GUI tool for my own project, it would take hours or days. But Claude got it done in 10 minutes.

I was surprised with how well Opus 5 did with open ended tasks. (I started out on XHigh effort, then dropped to High). I quickly learned to just describe the result I wanted rather than try to lead it by the nose on how to achieve that result. Sometimes it surprised me with what it came up with! And it saved me a lot of work. Opus is very capable, this kind of high level thing wouldn’t work nearly as well with a dumber AI. (You know, the ones that are just six months old...)

Having big data exports from Google, Twitter, and Flickr was a huge help. Those data dumps are hard to work with, they’re often just a big pile of JSON files and images and no organization. It’s 53GB of stuff for Google Photos! But the AI is very good at that kind of thing. I just pointed it at the .zip and said “figure this out” and it did.

Some AI things that didn’t work

The code the AI wrote seems to mostly work but I didn’t read any of it. I’m sure there are horrors there. But I don’t care for this project: as long as the AI can understand it’s own code it’s fine.

The code did run fine. But sometimes it was awfully slow. For instance for the image matching was taking minutes for each post. I aborted it and said “make this faster”. And so it did, mostly by rewriting the code to use numpy. I wish it had taken the initiative to make it faster itself. I wonder if Claude Code could be given agent instructions about when it was worth spending extra time to optimize something instead of relying on me to notice.

I don’t really know if the code is right. It wrote some 600 unit tests but they could be useless for all I know. I was validating the output by eye. If I were more serious about this as a real product I’d write my own high level system integration tests to really validate the output. Or at the very least have the AI write those tests and check very closely they are correct.

Claude is very verbose. It’s really quite annoying when talking to the AI agent and I bet the code is chatty too. This seems to be a problem with all LLM systems. Nothing it’s saying is particularly redundant or wrong, but there is an awful lot of it. Almost like it was talking to another LLM...

The workflow Claude came up with for the recovery process was very complex. I ran tool A and it’d generate a partial config file which tool B could use to get more data for the config file. Then run tools C and D to process, then go back and run tool A again with that extra data, etc etc. I never could quite figure out how to run it all correctly. This is mostly my fault, it reflects the iterative way we designed the whole thing. The good news is Claude itself knew how to run its own tools and was good at diagnosing and fixing failures, so I gave up trying to understand how to run it myself and just had Claude run it for me. That’s OK for a one-off hack like the recovery process. The Mastodon unroller I plan to keep using is much more tightly designed.

Some reflection

Claude tells me we spent about 20 hours working on this over 5 days. I typed 177 prompts to the agent. It processed just about 1 billion tokens in 4200 API calls. It says that’s nominally $685 worth of API usage although I did it all in the bounds of my $20/mo subscription.

Tokei says it’s 14,450 lines of Python code plus another 8600 lines of test code. That feels like an awful lot, I’d have guessed ⅕ that size if I wrote this carefully by hand.

I dunno how I feel about all this. Impressed, mostly. A little sad, I’ve always enjoyed crafting good code and I feel like that skill is suddenly much less useful. But honestly I haven’t been doing much of that in years now. I had a lot of fun getting an AI to build this for me.

I don’t love the emotional experience of working with Claude Code. It’s just fast enough that you mostly want to be paying attention, but still slow enough you get bored and do something in parallel. Most prompts I was typing were 2-15 minutes of work? I liked the Jules asynchronous model better, but then you have to trust it to work autonomously for longer tasks.

I still wouldn’t use an AI for something where the code quality really matters. Or rather I’d use it much more carefully. But for a data processing one-off job? It sure did a good job here.