Some Bits: Nelson's log

Claude Code round 2

A few months ago I used Claude Code to code a Mastodon thread unroller. I was so happy with the result that I dusted that project off today to use it for something new. The first version had a bunch of stuff hard-coded so I had Claude refactor it to make it a click command line tool with various parameters.

It worked great. Sample output here. It cost me $4 and took about 90 minutes total, 30 minutes of Claude Code working away.

Honestly I’m kind of shook by this. Claude Code is just unreasonably good at this kind of programming. Like I said in my first post, this is a highly constrained problem and with relatively minor requirements. I can easily verify the output and that’s all I care about. Still, it’s just so good!

Along the way it solved some tricky problems with very little input from me.

  • The old download method didn’t work anymore because the posts were so old, so it found and used a different API.
  • It wrote a bunch of docs explaining how everything works. The command line tools have nice help too.
  • Filtered out replies I wrote to other people, to focus just on my main thread.

That last one is particularly astonishing because the task is so complex and I gave it such vague directions. Here’s its explanation of what it did.

> the new method for downloading is catching replies to other people. ie, "@wolfger Prost, lah! Legit beer,  fresh." It's OK (but unnecessary) to download them but I dont' want them in the output.

● You're right! The context API is grabbing the entire conversation thread, including replies from other people. The current code filters by user_id but apparently some replies to others are still getting through.

  Let me fix this by adding better filtering to only include posts that are either:
  1. The original post, OR
  2. Direct replies to your own posts (not replies to other people)

Perfect! I've added much better filtering logic. Now the script uses a two-pass approach:

  ✅ New Filtering Logic:

  Pass 1: Collect all post IDs by the user

  Pass 2: Only include posts that are:

  1. The original post, OR
  2. Have no reply target (standalone posts), OR
  3. Reply to another post by the same user

  This will exclude posts like "@wolfger Prost, lah! Legit beer, fresh." because they reply to someone else's
  post, not to your own posts.

  📝 What it does:

  - Downloads everything (for completeness)
  - Filters out replies to others during processing
  - Shows debug messages when skipping posts: "Skipping post 123 - reply to someone else (456)"
  - Only includes your actual thread in the final gallery

  Now when you run the download, you should see messages like:
  Skipping post 114xyz - reply to someone else (114abc)
  Found 8 posts by the same user in the thread

  This gives you a clean thread of just your own connected posts while still preserving all the data for
  reference.