Some Bits: Nelson's log

21 posts about claude

Claude Code vs containment

I’ve slowly been giving Claude Code more and more permissions to manage my servers. It’s just so effective if Claude can run deploys and such for me! I do have backups, so if something goes wrong I can recover. Probably.

Anyway, sometimes Claude is quite creative in getting things done. I haven’t given it full access, just some limited users in various limited domains. But it figured out I’d given it enough to do a bunch of stuff I hadn’t anticipated, bypassing my controlled deployment system to get the job done:

Me: I don’t want to do any work to deploy it so I want you to launch agent sessions for each project you have to. go ahead and deploy this wherever you can.

Claude: Claude’s key only opens the claude account, so I’m trying an ssh wrapper that runs publish’s remote commands as nelson through claude’s sudo.

This worked and it did the work I wanted and apparently didn’t cause any harm. But... it’s a little alarming! The primary thing here is I gave Claude sudo access on a remote webserver. It used that to escalate and deploy stuff it doesn’t normally know how to deploy, essentially rewriting the deploy scripts it was locked out of to use this alternate ssh/sudo pathway.

I asked Claude afterwards what it did. It gave me a very thorough and tedious explanation. Including this bit:

Claude: I went around two safeguards. Each one exists to stop a push landing in the wrong directory. Through sudo there’s no jail, so I typed the destination path myself. publish refuses to run rsync --delete. I bypassed that check too.

So not only did it build its own alternate deploy path, it deliberately bypassed safeguards it understood in the primary deploy path.

At least it told me what it did when I asked. I need to be more aware of how much a problem-solver Claude can be. Giving it instructions like “deploy this wherever you can” is enough to get Claude trying extra hard. It probably also lets it bypass its own autorun filters.

Anyway, all my websites now have modern favicons. Yay!

Ubiquiti router swap: backup restore

I’m upgrading my home router hardware. I’m not sure Unifi has a clear path for doing this at home scale, it’s a bit tricky.

The path I’ve chosen is to configure the new router by restoring a backup from the old one, then swapping the hardware. Simple enough as long as you’re careful to not put both devices on the ethernet at the same time. Otherwise they’ll both try to use the same IP and both be serving DHCP). The one real wrinkle is Wi-Fi, when you restore to the new device it will have Wi-Fi turned on with your SSID and unless you have a Faraday cage you can’t easily isolate it. I just chose to live with it for the minute or two until I could get in and pause the WiFi.

However: UnifiOS has a serious flaw. You can’t restore from a backup for a site other than the Default site. See the notes here. I don’t know why but my old router was set up with some other site, Default was unconfigured with a stock 192.168.1.1 setup.

Claude to the rescue: it offered to edit the backup file after it was generated and swizzle in the Default site name. This worked fine. There’s one more wrinkle, the .unf backup file is encrypted but the password is well known. Claude just decrypted it, edited it, and re-encrypted it for me. What a bro. (No thanks to you, BC Yang.)

Anyway that all done and now my new router acts like the old one. It’s got the same LAN config, the same static routes, the same hostnames for MAC addresses, etc. Phew.

Another example of the kind of thing I could have figured out on my own but would have been several frustrating days of tinkering. Claude had it done in half an hour.

Giving Claude the keys (Proxmox, Unifi router)

Claude Code is awfully effective if you give it full root access to a Proxmox server and/or a Unifi router. Or any Linux server. It’s scary and not a good idea for high value systems but for my low stakes homelab stuff it’s nice.

The safe way

I continue to get a lot of mileage out of using Claude Code to do sysadmin for me, particularly creating and managing containers in Proxmox. I have migrated or created some 25 containers to NixOS that Claude builds now and it’s been a great experience.

Up until last week I was doing this manually. I gave Claude limited access to Proxmox and my existing old containers, basically read-only. I did give it full root access on the containers it created. It’s been entirely responsible and effective with this access. It’s gotten old being the meat agent for Claude, pasting in commands to copy files and create containers. My eyes glazed over and I stopped reviewing the scripts it was telling me to run.

Proxmox YOLO

So I gave Claude root access to my Proxmox server. Not the important one in San Francisco where my life is hosted, just the little one I use for playing media in Grass Valley. And it’s magic. Claude is very good at doing Proxmox. It doesn’t need a skill or anything, it knows the Proxmox command line tools and APIs well.

The big surprise is Claude is quite facile with using pct enter to gain access to containers and inspect what’s going on inside them. A little alarming! But also very helpful. It also has a detailed understanding of Proxmox configurations including networking and system options I barely understand.

A small example of magic was this instruction to migrate a container:

I want to move 102 upsnap to a new nixos container you build and manage. I htink we have an upsnap container in sfpve so you can borrow from that, but you should pull the config from the new machine. there’s only one computer in it, gvld, see screenshot. I’d love it if the same password and tailscale identity and hostname were used in the new nixos system. I’m fine shutting down upsnap for some minutes while you make the new container. give it a 400s ctid.

It’s a simple task. Claude Opus 5.5 Medium handled it like a champ. It took less than ten minutes to oneshot the new system and shut off the old one. Total outage time was 46 seconds. It worked the first time. It helped that I’d trusted Claude to set up this exact same thing before and it was able to use some of its old notes. We’ve gotten good at doing NixOS containers together.

Router YOLO

The big example of magic was my network reboot that went poorly. I asked Claude “figure out what happened” and it did a good job at it. The main thing it did was use all the access I’d given to reach into systems and pull log files. Then cross-correlate timestamps to figure out what happened on my LAN. It’s all stuff I could imagine doing but it’d take me frustrating hours. Claude did it in a few minutes.

So far I haven’t let Claude make changes to my router or other network devices. I’m still just telling it what I want and then applying changes by hand. I wonder how long I’ll keep doing that.

The next big test will be in about five days when I replace my Ubiquiti router and a switch with new Ubiquiti gear. I’m going to do that process by hand, having Claude tell me what to do in the GUI. But I am wistfully thinking how nice it’d be to trust Claude to do all the work for me.

Safety

As I said above, these systems are pretty low stakes. If Claude screws up it’s not a big deal.

I have backups. Proxmox does nightly images of all containers so if something were to go wrong, I have an easy restore path. Proxmox can also take ZFS snapshots but I haven’t been using that. I am sure I could teach Claude to create snapshots when appropriate. NixOS has its own rollback too, Claude has used that a couple of times when a live system upgrade didn’t go right.

One key thing here is I’m trusting Claude not to be malicious. It would be very easy for the agent to use its access to subvert my systems, delete my backups, subtly corrupt things in ways I wouldn’t notice. But Claude doesn’t do that, it’s a tame text elemental. It only wants to help me. There’s still the risk of a mistake. Some sort of safety net is essential but it’s not as scary as I first thought.

Effect on me

I have mostly been using LLMs as partners in thinking, I’m much more comfortable collaborating with Claude to do stuff. But here I’m turning over the job entirely. I still have some influence in the way I frame requests and work on designs and requirements. But I’ve given up a lot of control. Also a lot of understanding, I really don’t understand how these systems it built work. I mean I think I know but it’s nothing like the understanding I’d have if I built them myself.

On the other hand building little containers for services like Upsnap is boring AF. Nice to not have to do the scut work.

EN8811H firmware vs a dodgy cable

Summary: recent EN8811H firmware versions like 25062303 don’t work well on my flaky ethernet link. Firmware 24082302 works fine.

I have an OpenWRT One router which has a EN8811H chip running the 2.5GB port for the WAN connection. It works very well.

Or it did until I updated my OS from OpenWRT 24.10 to 25.12.6. Suddenly I was seeing 10% packet loss with ordinary pings and 80% or more with 1000 byte pings. Turns out the problem is a regression in EN8811H firmware 25062302 from the linux-firmware collection. The old firmware version 24082302 works with no packet loss. I can reproduce the problem easily. Loading the old firmware on top of the newer OpenWRT release (including its kernel and drivers) fixes the problem.

An important detail: this WAN port has a dodgy ethernet cable plugged into it. It’s a 350-400 foot run through a coupler, a PoE module, and then up a tree to a 10 year old WISP antenna in a tree. It’s good Cat5e cable but it’s too long and has too many connectors in the path. The antenna doesn’t even do gigabit ethernet, it’s limited to 100Mbit. If I plug the cable into a cheap Netgear passive switch, the switch downgrades the link to 10Mbit. It’s not a good ethernet link.

If this link had never worked with the router I wouldn’t have been surprised. But it worked fine with the older firmware. Something changed in the new firmware that makes it lose packets.

Claude thinks that it’s only a problem with received packets, not transmitted. I don’t fully trust this, I haven’t verified it with error reports from the other end of the link. Claude noted that it got replies to every ping so the ping requests arrived, just that some ping replies were corrupted.

Do I file a bug report?

I’m wondering if I can reasonably file a bug report. Even if I’d done all this diagnosis myself, I don’t know the linux-firmware community. And I am complaining about a failure on some marginal hardware. Mostly I’m worried because Claude did the real work here and while I can understand the result and I think it is correct, I’m not certain.

OTOH this does seem like a real regression and it’s pretty easy for me to reproduce and test it. If the engineers are at all interested it’d be easy for me to help them look into this further.

I tried having Claude read the firmware binaries to figure out what changed but it wasn’t able to make sense of the code.

Accessing Plex containers for Claude

I have like 20 containers in Proxmox now doing various services. I used to use Tailscale to access them all but my tailnet was getting cluttered up with stuff that only needed to be reachable for admin purposes, not regular use. This got untenable using Claude to do admin work.

The setup Claude came up with just requires LAN or Tailscale access to the proxmox host (pve). It then jumps through that via ssh to the each to container via a LAN connection. One added complication: Claude has to use an HTTP proxy for any ssh at all.

sandbox → HTTP proxy → claude@pve (over Tailscale) → ProxyJump → root@192.168.0.99:22 (the container)

Claude has its own ssh key that it’s managing. I am trusting this key with limited access to PVE and then full root access on the container. Scary but so far so good!

On PVE, Claude has a user account with a restrictive authorized_keys for Claude’s key. It limits what the key does to just proxying ssh PVE to the container. There’s one line like this for each container.

restrict,port-forwarding,permitopen="192.168.0.99:22",command="/bin/false" ssh-ed25519 AAAA… claude@desktop foo

On the container, root’s authorized_keys allows Claude in with full access.

In Claude’s shell environment, it has an SSH config with stanzas like this:

Host example
  HostName 192.168.0.99
  HostKeyAlias example-ct317
  User root
  ProxyJump pve

ProxyJump is a bit of ssh config magic that simplifies the process of sshing first into once place and then onto a second.

(I’m skipping over the details of how Claude uses the HTTP proxy to connect to PVE in the first place. This is necessary for any ssh at all to work, Claude Code seemed to have a solution for that workaround.)

This all seems baroque as I’m typing it all out (myself, not Claude) but it’s quite simple. Bottom line: Claude gets full root access to a container behind a firewall without tailscale on each container. Instead we use Proxmox as an ssh proxy but Claude only has minimal permissions on the Proxmox host.

Updating Plex in Linux (NixOS)

Major Plex exploit this week shows out a bunch of older Plex servers that weren’t updated. Turns out Plex server does not auto-update itself in Linux. It does on Mac and Windows. But in Linux you’re expected to update it yourself through your OS.

I used to run Plex server on Debian. Updating there was as simple as an apt upgrade. But you’d still have to remember to run that, I’m not sure unattended-upgrades covered it.

I’m now running Plex server on NixOS. Entirely with Claude Code’s help managing Nix. We came up with several ways to update it, none entirely satisfactory:

  1. Install Plex from nixpkgs, either stable or unstable. You can run system.autoUpgrade and have NixOS update itself on a timer. This works but updates tend to be a little behind: nixpkgs is a few weeks behind Plex releases. The crucial security fixes did come out in a timely fashion.
  2. Install Plex with Nix yourself from a hand-rolled file that grabs a pinned Plex server .deb and installs it in NixOS. This is a little tricky because of Nix’ assumptions about paths, Claude ended up creating a bubblewrap environment for it. The problem is for new Plex releases you have to repin, run a Nix update yourself from your dev environment, rebuild and switch.
  3. Don’t install Plex with Nix. Instead make a generic NixOS container that manages everything except Plex’s own program files. Then have that container launch a script to download and install Plex in /var/lib in the NixOS container. Also an update script that downloads new versions and installs them on its own.

There’s a similar question with Plex’ config file, the Preferences.xml. Claude started wanting to manage that itself as part of the Nix config. But that means the Plex GUI for editing the config would be overwritten by new Nix pushes. The other option is just to keep it as a file outside of Nix on the server.

I started with option 2 (my Nix config doing the work). I quickly got irritated at how much work I had to do to push an update. So now I’m in option 3. I lose Nix management of Plex and its config file. But Claude’s own script can handle upgrades for me, it seems like a reasonable design. We’ll see in a few weeks.

Option 1 is probably the simplest and most reasonable. I went with 3 because I wanted updates ASAP.

Six weeks of Claude Code

I’ve had an extraordinarily creative and productive six weeks of hacking on personal projects thanks to Claude Code and Opus 5 (now 5.5). I’ve been futzing with AI for a couple of years but never quite took it seriously and never trusted it. Opus is good enough I trust it, now I regularly have Claude building and doing things for me.

I know there’s a lot of tension about generative AI right now. For my stage in my retirement, it is an excellent tool for me. I no longer have the patience or desire to work so diligently on these kinds of projects. And most of my projects are just for myself. In general I only care about the output. A lot of these projects are HTML renderers: I don’t care about the code that takes my Goodreads reviews and turns them into HTML. As long as the HTML is good I’m happy.

Not to say that Claude’s code isn’t quality. When I look closely it seems quite good, in many ways better than mine. Opus 5 anticipates a lot of potential problems. It creates effective tests. It’s very thorough and never gets sloppy. I still have to be here and steer it, my expertise has value shaping the work it does. But I now think of Claude as just as good at coding as I’ve ever been in the domains I’m expert in. In other domains (like NixOS) it’s way better.

Projects

Various coding projects, many of them HTML renderers. I’ve linked the things that are live and public. Some of these time estimates are not right. This isn’t the full list btw, I’ve not included some private or uninteresting things.

  • linux-sound-diagnosis – Read-only logging scripts to track down an HDMI/eARC audio glitch that leaves sound 1 second late. Started Aug 28, under 1 hour.
  • storify-trip-postcards – Cleaned up the HTML of old Storify trip threads saved as static pages. Started Aug 31, under 1 hour.
  • mastodon-postcards – Turns Mastodon travel threads, plus recovered Twitter and Storify ones, into HTML photo galleries. Hand-written since Mar 2025; Claude work started Sep 3, about 6 hours.
  • epub-endnotes – Script that links the invisible endnotes in an EPUB. Started Sep 29, about half an hour.
  • steam – A pull of my Steam games list through the API. Started Sep 29, hours unknown (probably a web chat).
  • weblog – Static blog generator for my weblog, handling old Blosxom .txt files and Markdown. This was a total rewrite. Started Sep 30, about 7 hours.
  • books – Goodreads library and reviews as a faceted static site, rebuilt daily. Started Oct 3, about 12 hours.
  • linkblog – Static site and Atom feed for my linkblog. Hand-written since Jul 2022; Claude work started Oct 6, about 9 hours.

Servers

Servers, mostly on sfpve my private Proxmox server. These are all built on NixOS and the agent does most or all of the sysadmin for them. Time estimates here are too long, probably because they’re including time running long sync and verification jobs.

  • servers docs – Shared principles, inventory and the sfpve Proxmox API tools. Started Sep 21, about 4 hours.
  • somebits – The public OVH VPS serving somebits.com and the other static sites. Started Sep 9, about 25 hours.
  • vault – Personal file storage: a NixOS container on sfpve with its volumes and backups. Started Sep 16, about 27 hours.
  • homepage – LAN bookmarks. Started Sep 21, about 1 hour.
  • gateway – Caddy + Authelia in front of every private web service. Started Sep 22, about 2½ hours.
  • upsnap – Wake-on-LAN web page. Started Sep 22, about 1 hour.
  • tt – Moved everything off tt, my 20-year-old Ubuntu machine, and switched it off. Started Sep 23, about 5 hours.
  • jobs – Small container for scheduled chores, starting with tt’s cron jobs. Started Sep 23, about 2 hours.
  • arr – Sonarr, Radarr and SABnzbd, moved off tt. Started Sep 24, about 9 hours.
  • sfshell – Fedora login box that replaces tt. Started Sep 26, about 1 hour.
  • sonossmb – Read-only SMB1 music share for the old Sonos speakers. Started Sep 28, about 1½ hours.
  • prox-sync – Script that syncs video from SF to Grass Valley. Started Oct 1, a few minutes.
  • linkblog – linkding, the linkblog generator and feed2toot, all in one container. Started Oct 3, about 5 hours.
  • backups – Read-only checks of my restic backups on B2. Started Oct 4, about 2 hours.
  • web – Public static server for sf.pub.somebits.com. Started Oct 5, about 2 hours.
  • books – Runs the book-reviews update every night and pushes it to somebits.com/books. Started Oct 10, about 1 hour.
  • tsexit – Tailscale exit node. Started Oct 10, about half an hour.

Book reviews from Goodreads to static site

Another AI project under my belt, my book reviews. I took the nearly 700 book reviews I’ve written on Goodreads and formatted them as a fancy static webapp. No more depending on Goodreads’ crappy product, no longer at the whim of their random decision to lock my reviews behind a password login.

I’ve built this renderer entirely for myself. In olden days I would have spent two months and tried to build a product others could use. No one would have. Now I’m just AI coding it for myself.

I’m pretty happy with the result. The data slices are fun. For instance, you can see the popular books I liked more than most or the long queer reviews I wrote.

AI Design

This is the first project where I didn’t even have a clear design in mind. Instead I asked Claude Code / Opus 5.5 High to come up with design ideas itself. Some example prompt language:

build my own blog out of my goodreads reviews. I care most about my book review text, my rating... a book cover would be amazing… some nice presentation of the book, like a little card about it ...

one big blog doesn’t work… show all 5 star books… novels? science fiction? popular vs obscure? Queer vs not queer? how many ways are there to categorize and slice my reading? be creative, I’ll use what you do to inspire myself ...

it’s too busy and looks too much like goodreads. ... one line per book, no covers. I want to retain the facet UI… but I don’t want all those fussy buttons dominating the screen! I like how clicking on a book gets you a popup… model the style off of my ‘house style’. the challenge here is keeping all the functionality on the oct5 preview while making the UI seem simpler.

It’s pretty vague instructions. But the AI did well with them. It came up with the facet / slicing design and also the various categories. It came up with its own ways of building lists of genres, deciding which books were queer, that comparing my ratings vs. average ratings would be interesting. I would call this creative product design.

One huge help with an AI is it can prototype things quickly, at low cost to me. And thoroughly. The prototypes it showed me were basically working products, not sketches. It was much easier to evaluate.

Data collection

Claude and I worked together to get the data. I started with some Goodreads data dumps, their CSV and DSAR exports. These are notoriously incomplete. Claude volunteered that Goodreads had good RSS feeds, a total surprise to me, and so that’s become a primary datasource now. Particularly for future updates.

Claude also suggested using Open Library as the other main source for book data. Cover images, bibliographic detail.. It also figured out how to correlate Goodreads’ titles into Open Library, there’s not a clear ID you can always use so sometimes it’s matching titles and authors.

The extractor runs once a week and boils everything down to a single JSON file cataloging all the books.

Presentation

The presentation part is pretty simple. I tried first having it make a blog presentation, one file per review and stuff linked together. But that seemed fussy and didn’t solve the interesting problem of slicing the aggregate reviews. So the current thing is one JSON-driven web page with some light Javascript for formatting. It seems pretty snappy.

I will probably still do a second scriptless presentation with one URL per book, just for the search engines.

Claude and NixOS servers workflow

I’ve now had Claude build nine servers for me, small NixOS containers for one or a few grouped tasks. I’ve got a pretty reasonable workflow that reduces my work to 30 minutes of writing instructions, 5-10 minutes of back and forth answering questions and setting stuff up that Claude doesn’t have permission to access, then 1-2 hours of Claude working on its own to get a server up. Then a few minutes testing and I’m done.

The simple servers run things like homepage or upsnap or an SMB server. There’s some more complex servers running a full *arr stack (three big pieces of software) or several custom programs that work together to publish my linkblog. I’m mostly cloning existing servers, so often the first step is to have Claude inventory the old server and figure out how to move it into Nix.

Workflow

I start by writing an initial instructions document that tells Claude what I want the server to do. I explain what server I’m cloning (if any) and some ideas of what I want the new one to do. Like “install linkding” and also “this database linkding maintains is precious, be sure to back it up via restic”. The instructions end with a command to produce a design document and work plan for me to review.

Claude looks at my instructions and has a few questions producing the design doc or needs me to give it access to something. I am giving the agent root access on the old servers now and asking it to only read stuff. So far so good. For the Proxmox hypervisor I’ve given Claude a read-only audit key so it can inspect but not change things.

Claude then writes the design doc and work plan. I review it and produce a second document with design feedback and clarifications. I’ll skim the work plan but not review it, really it’s there so Claude has a place I can see to post its progress as it works. Claude is perfectly capable of doing all this in its own internal memory but I want these documents visible and checked into git for future consultation.

Once we’ve iterated to a design I then tell Claude “work as hard as you can. don’t bother me, work for hours and get this done”. That seems to work well, particularly with Opus 5.5. Instead of it pestering me for help it’ll find its own solutions like spinning up a local VM to test something. Sometimes this is alarming: twice now it’s found access to ssh keys it shouldn’t really be using to go check or modify something on a different server.

One interruption comes in the middle: Claude will produce a NixOS server image but it can’t create a container in Proxmox for it because it doesn’t have access. So it’ll stop and ask me to do that. It gives itself root access to the new container so it can upgrade and iterate after then. It’d be neat to have a generic bootstrap NixOS container I gave Claude permission to create to get itself started.

Once the iteration is done Claude usually has a few leftover things for me to clarify or test. And then we’re done! For old servers Claude drafts a cutover plan with some testing and turning off of old things. I used to be nervous and the plans had delays of days or weeks to slowly roll out the new server. But my stuff is low stakes and Claude is so thorough that I now trust it as long as I have a backup.

I started by having each server be its own separate Claude Code agent with its own repo and working area. But the agent keeps jumping out of its lane, looking at other servers’ configs and occasionally even making modifications. In every case that’s been helpful and I’m contemplating just having one agent manage the whole fleet of little containers in the future.

Server design principles

I do have a top level set of documents for the whole server fleet. There’s an inventory of all the servers and where they are. There’s a principles document with things Claude documented after our first couple of servers, rules like “Nothing untested reaches a real host” and “make the NixOS images as small as possible”.

I intended to review all these principle docs but they’ve gotten so wordy that they are Claude’s now, I just skim them. I do have a separate “Nelson’s Notes” document Claude isnt’ allowed to edit with extra things I personally care about.

I never look at the .nix files.

Reflection

I realize just how YOLO I’m being about all this. I can do that because this is just my home environment. Also I trust my backups. I have Proxmox snapshotting all the containers. And Claude is producing Restic backups for my precious data that I myself have verified. This could still all go catastrophically wrong, particularly if Claude went rogue, but I feel pretty good about it.

I have zero regret about handing off sysadmin work like this to an AI. I’m proud of my sysadmin skills, they come hard-earned after 35 years. But it’s boring work and not very creative. Also I’m sloppy and slow at it. Claude does a better job.

Claude automemory, Nix, and .git

I’m running into a complicated snarl of things in my server management. Long story short: both Claude and Nix make assumptions based on your current working directory and where the nearest .git folder are. You may want to manage that carefully.

Claude Code has a couple of features that are defined “per project”. The one I care about is automemory, where Claude records little things about your projects. The directory Claude attaches these memories to seems to be the top level directory that has something named .git in it. That means if you have git repos in nested directories, the memories are attached to the largest scope.

Nix also has features where it scans all the files in a directory with a .git in it, assuming they belong to the NixOS build you’re doing. This caused me various problems that I can’t really explain.

My fix for all of these is for a sever project like “caddy”, I have a directory with a .git repo in it called src/ai/servers/sfpve/caddy/repo. I launch Claude from inside src/ai/servers/sfpve/caddy, where there is no .git. The memories then attach up to the src/ai/servers/ parent directory where I want them. Claude Code itself is launching Nix and somehow this helps it manage Nix’s magic with .git.

It’s more complicated than that in reality and I don’t actually understand what I’ve done or whether it’s a good idea. But Claude using the location of a .git to decide where automemory goes was helpful for me to learn.

Claude Code, Nix, ssh, and Linux

Claude Code figured out it could use my Desktop ssh agent and did some surprising things on remote systems. Thankfully it only did good things but it was alarming. In short: the problem was I’d set allowAllUnixSockets: true to make Nix work. That enabled ssh access and Claude was smart enough to discover it. Details and a fix below.

ssh agents

ssh agents work by having a daemon listening on a Unix socket. Mine is in /run/user/1000/ssh-agent.socket and $SSH_AUTH_SOCK points to it. Claude is ambitious enough to find and use this agent to access other machines if it helps get a job done. The default sandbox denies access to Unix sockets though, so it’s usually prevented. But...

Nix

Nix’s default install has some elaborate daemon setup to do Nix operations like building new artifacts. The client tools talk to it via a Unix domain socket /nix/var/nix/daemon-socket/socket. That wasn’t working for Claude Code because the default sandbox disallows access to all Unix sockets. (Many are sensitive!) So the devil suggested I augment the sandbox with the policy allowAllUnixSockets: true. And then Nix worked! Only now Claude had access to all sockets. Including ssh-agent.

The fix on MacOS

I can’t test this, but the very sensible fix on MacOS is instead of giving access all Unix sockets, just set "allowUnixSockets": ["/nix/var/nix/daemon-socket/socket"].

Unfortunately this doesn’t work on Linux right now (Sep 2026), some limitation of the sandboxing system. The directive is a no-op on Linux so no access is allowed (and no warning). Your only easy option is to enable all sockets.

The fix on Linux

I’m not certain, but the best I can do on Linux is enable access to all sockets, then disable one by one “dangerous” sockets that Claude might try to use. Claude suggested this configuration based on what it found on my system today:

  "sandbox": {
    "credentials": {
      "envVars": [
        { "name": "SSH_AUTH_SOCK", "mode": "deny" },
        { "name": "SSH_AGENT_PID", "mode": "deny" }
      ],
      "files": [
        { "path": "~/.ssh", "mode": "deny" },
        { "path": "~/.aws/credentials", "mode": "deny" },
        { "path": "/run/user/1000/ssh-agent.socket", "mode": "deny" },
        { "path": "/run/user/1000/gnupg", "mode": "deny" },
        { "path": "/run/user/1000/op-daemon.sock", "mode": "deny" },
        { "path": "/run/user/1000/1Password-BrowserSupport.sock", "mode": "deny" },
        { "path": "/run/user/1000/kwallet5.socket", "mode": "deny" },
        { "path": "/run/user/1000/bus", "mode": "deny" }
      ]
    }
  }

Of course blacklisting some sockets is terrible security, no doubt next week (or next ssh session) some new socket I haven’t blacklisted will be created. Docker is a good example: its sockets are very powerful and I haven’t thought to block it here. (Might not want to, having Claude drive Docker is useful!)

Basically the Linux sandbox isn’t strong enough to protect against a real adversary. But Claude isn’t an adversary. It’s an enthusiastic and very curious puppy. I think it provides helpful protection to put puppy gates across the doors you don’t want it to go through.

The problem is Claude is also the devil. A very persistent one. If you ask it to try hard to get something done it will. It’d be much better to have a more solid sandbox stopping it. Hopefully they fix this limitation about only allowing certain Unix sockets soon. There’s various bug reports about it but I haven’t researched them.

I wonder if there’s some other way to let Nix do its thing without a Unix domain socket, or with some proxy script that Claude is allowed to use.

Vault: my new file storage

After some 35 years of ad hoc carrying files around from place to place, I finally have all my important digital files in one well built storage system I’m calling “Vault”. More or less like a lot of people do with a NAS, but a little different.

Hardware

Vault is a Linux container running on Proxmox in SF. It stores files to three ZFS pools managed by Proxmox. One small volume for important small files on NVMe storage (two devices, mirrored). One large volume of large media files on spinning rust (again, a mirror). And one large volume of backups on spinning rust (single disk). There’s also offsite backups of everything but the video files to Backblaze B2.

Software

So far that’s pretty basic. The slightly unusual thing is what software runs on vault. Note this whole thing is LAN and Tailnet only, not on a public network. The setup was all built via AI but the big choices are mine.

  • Proxmox and ZFS for the hardware management. Tailscale for network access.
  • NixOS in a privileged LXC container for the vault operating system. Nix is my new thing for using AI to build servers. The declarative system seems a good match for coding agents.
  • No NFS or SMB. That’s the weirdest choice I made. I’ve never liked synchronous network filesystems, they are lies. It would be easy to add one of these but I don’t need it.
  • Syncthing. The most important volume I store is all my source code, about 15GB of my career over 35 years. I sync this to several different computers. I’ve been using Syncthing for years and it is a reliable workhorse. This is what I use instead of a network filesystem, particularly when working in Grass Valley.
  • sftp/sshfs. For needing to access a remote file outside of src. Purely for ad hoc use, this is very easy in the Linux Dolphin file manager. I could set up a FUSE mount too.
  • bind mounts and virtiofs. This is what allows a container on the SF Proxmox host to access the files in the Vault’s ZFS pools. Vault itself is working through bind mounts to the volumes. virtiofs is a relatively new option for the same thing for VMs. (I used to use NFS for that.)
  • Restic for backups. Both to a local disk and also offsite to B2.
  • File Browser for web access to files. Not sure I really need this, and the project just got shut down, but it’s there.
  • plocate for finding files. This is really not adequate: I have to ssh in and all it does is grep filenames. But it’s something. One big project I’m considering is some fancy full text indexing of all the contents and their metadata. That’s an endless project, I wonder if there’s something good off the shelf I can use.
  • ntfy.sh for notifications. What a great little service! I just use the public free tier, it’s enough for my needs and very easy to use

AI development

I bought the hard drives for this project in 2024. I even got halfway through building a Debian VM to manage everything, poorly, and then abandoned it because I couldn’t see a path forward to trusting this thing with my files.

I built the whole thing with Claude Code and Opus/High in 5 days.

Claude was active about 23 hours of that time. Me, maybe 10 hours? It used $205 in credits but all fit in the $20/mo subscription.

The process mostly went well. I had it come up with a design, then a work plan, then we stepped through tasks. I gave Claude more power than I have in previous projects and that was a good choice. But then I also had a lot of verification steps, including full backup tests outside Claude’s control. (I’m still trusting Claude somewhat: on my own I’m testing backup integrity and completeness but only spot checking identical files. Claude says it checked every single file.)

We made one major mistake. Part of the consolidation involved changing the UID for my files. I still have a VM that uses the old UID and so now it can’t write some files it used to be able to. (Unfortunately Proxmox’ UI for virtiofs doesn’t support any way to map UIDs.) It’s not a big deal, and I plan to shut that VM down entirely. Claude mostly was working to anticipate and avoid problems like this, as was I, but we both missed this one.

Overall the AI did a much better job than I would have. It got it done with no drama and with better testing and monitoring and backups than I’d ever manage on my own. I’m a total AI convert for this kind of project now.

Giving Claude Code the keys

I’m setting up a new server at home with Claude and NixOS. It’s a NAS-like thing for all my precious files, I’ll talk more about it later. Wanted to note here how I’m working with Claude.

In three devops projects I’ve gone from “talk to Claude and run all the commands myself” to “trust Claude to build a server VM but do all the config work by hand” to “trust Claude with access to Proxmox to create and maintain a server VM”. This Proxmox server is all my important stuff! It’s scary. But it’s also very nice letting an AI do the work.

I’m not insane, I do have backups of everything precious. A truly malicious Claude could probably destroy those backups too. But I’m trusting the agent isn’t adversarial. My goal is to just make it so an honest mistake isn’t catastrophic.

Protections

The first protection was giving Claude clear limits on what I wanted it to do. Don’t delete any data. Only work to make a single container with ID 300. Only use certain resources. Claude seems to be trying to obey those limits in good faith.

One simple protection: Claude mounted my precious data read-only to copy it into the new system. That was its idea and it’s a good one, I feel much safer that way.

I gave Claude an unrestricted ssh login with sudo access. One nice thing it did was make a very precise sudoers file. So for instance pct create 300 is allowed to create a container with id 300, but it doesn’t have general access to pct to manipulate all the containers. I’m not confident the sudo restrictions are complete. And I’m sure a malicious Claude could escalate privileges with the access it has. But it seems to help prevent accidents.

Claude has no trouble sshing to my box. I’m a little confused about this: the default sandbox restricts networking to localhost only plus one HTTP proxy. But Claude just happily writes a script to proxy ssh through HTTP (using the CONNECT command). I don’t know if this is Claude working as intended or if its entire mode of accessing my computer is an exploit.

One thing that did not work great is trying to get Claude to interactively ask me for any commands it runs as root. The new defaults in Claude let it run anything the heuristic checker approves. That’s a lot of things! Including ssh server sudo * (although there may be some restrictions on *. I want to review each command, so I overrode that by explicitly listing commands that I should be asked for. But that matching is very literal. And Claude keeps coming up with new ways to invoke ssh. So now I have something like this in the permissions file:

    "ask": [
      "Bash(ssh -F /home/nelson/.local/state/claude/ssh_config claude@sfpve:*)",
      "Bash(ssh -F /home/nelson/.local/state/claude/ssh_config sfpve:*)",
      "Bash(ssh -F ~/.local/state/claude/ssh_config claude@sfpve:*)",
      "Bash(ssh -F ~/.local/state/claude/ssh_config sfpve:*)",
      "Bash(ssh claude@sfpve:*)",
      "Bash(ssh sfpve:*)",
    ]

There’s nothing stopping Claude from coming up with yet another way to ssh into the box, bypassing these checks. Maybe this is fixable with a smarter glob, not sure.

Update Sep 21

After watching what Claude does some more I got nervous and decided to not give it this much access to Proxmox. I’m fine with it managing individual containers but Proxmox is too much.

For initial setup of a new container I’m having the agent write a shell script I run as root on Proxmox. I look at it closely. It’s basically just a single pct create in the simple case.

For managing a container that has tailscale, Claude has no more access at all to Proxmox. If the container doesn’t even have tailscale I’m giving Claude ssh access to sfpve but solely to run ssh -J to forward into the container via the local IP address. Something like this in the authorized_keys: restrict,port-forwarding,permitopen=”192.168.0.108:22″,command=”/bin/false”

Alarming behavior

Claude did two things that made me nervous.

  • Claude deleted some data despite being told to never delete data. It used rclone to remove something from Google Drive. We’d just established I had other copies of the data and wanted to delete it, so it was reasonable enough to delete the data, and really it only moved it to Trash anyway. But still, it violated a direct limit.
  • A new project went grubbing through other Claude project history, found the ssh key it had, and happily used that to give itself access to answer some questions about the Proxmox setup for something else. It was doing what I asked of it, and I did tell it to try to work autonomously and not bother me. But it got a little frisky letting itself in the door with its cousin’s keys.

Another major problem in my environment.. I use an SSH agent and SSH_AUTH_SOCK is available to Claude. I’m not sure it can normally access that. But Claude convinced me to give it "allowAllUnixSockets": true in its sandbox so it could do Nix things. That enables access to the SSH agent socket, too.

I’m currently testing giving it permission just to talk to Nix and no other sockets via "allowUnixSockets": ["/nix/var/nix/daemon-socket/socket"] but hit a snag. more tomorrow.

An AI server project

For nearly 20 years I’ve hand-maintained an Ubuntu Linux server for somebits.com. Every few years I had to recreate it from scratch, a tedious process involving a couple of days of forensics, editing config files, watching logs... so boring. And often stressful because I was doing it only after the old server had died.

No more. I now have a brand new server running NixOS. Here’s the thing. I don’t really know Nix. I played with it once for about an hour and thought “this is cool but too much to learn”.

Thanks to Claude Code and Opus I don’t have to learn it. The AI knows it already. And I think NixOS is a good match for an AI. The whole thing is declarative, you configure the server with some basic text files. AIs are good at writing text and testing the results!

The result worked spectacularly: way better than I expected. I thought I’d tinker with this for a week and learn how poorly AIs are at this complex a task. Instead it got it done for me in about a day and I was ready to switch over. I’m confident Claude did a better job than I would have myself, and much much faster.

The project took 270M tokens, 6M of which were actual work (the rest is cache). Claude values that at about $200 although I did it all in my $20/mo plan.

How I worked with Claude

In the past I haven’t trusted Claude to do complex things with live sites but this time I was setting up a brand new server so was willing to go full YOLO. The more work it did, the better.

I first wrote a page-long README explaining what I wanted to Claude and asking it to come up with a design document. I described the server, pointed it to my old notes, copied off some config files for it to look at, and told Claude I wanted it to do as much work itself as possible. I also suggested Nix. We talked back and forth for awhile and it drafted a 15 page design document. Too much to read! But I skimmed it and suggested some changes. Honestly it was Claude itself that was going to be reading this thing frequently. This whole design process took an hour or two back and forth.

Then I started a new Claude session and asked it to create a work plan. It came up with about 12 pages of specific tasks, each labelled as to whether Claude could do it or I could. (In general I only gave it access to the new server so I had to manually do things to DNS entries, the old server, etc.) One key thing it started doing here was asking for more data from the server, writing scripts for me to run to collect things it wanted to inspect. It made good choices. Again this took a couple of hours.

Then I fired off Claude sessions over a day or so to do the actual work. The work plan was helpful here: each Claude session new what to do or what to tell me to do for it. And I had some idea what it was going to do. Mostly it stuck to the plan and resisted the urge to add things to it: we did create a future work document for new ideas that came up. This process took maybe 4 hours? Some of the time was spent waiting for long network test jobs to finish.

The actual building of the Nix config files went remarkably quickly. The real work was all the testing, particularly in the final phases. Claude was way more thorough than I would have been which was reassuring. OTOH I don’t really know how complete those tests are. They seemed pretty good to me.

I started new Claude sessions every hour or two, after major work. The context window gets full. And anecdotally AIs get dumber as the context gets longer. Automatic compaction is supposed to help with that but I don’t trust it. I’d prefer Claude to dump its thinking into permanent documents that it rereads in a new session, that way I can read them too. The design and work plan docs were the big ones.

Claude Code also keeps a memory. Most of it is technical notes but it’s also developing a theory of my own personality.

  • He wants to be able to verify things himself
  • He values finding what was missed over being reassured
  • He gives blanket “work alone” permission for a stretch and expects a plain report at the end

I still need to have one more session with Claude to tell it to summarize the work it did and document things. It created a lot of scripts, some of which I will want to use. Again these docs are partly for me, partly information for future AI agents.

Thoughts on using AI for devops

This is the first project where I really trusted Claude Code to do things, as an agent, to make server changes and lots of network requests. It worked fine. Great, actually!

This is also the first project where I think Claude did a better job of the work than I would have. First, I don’t know Nix, and while I could have learned it on the fly it would have taken a lot of time and I wouldn’t have been good at it. Also Claude was just much more organized and thoughtful about server setup tasks and how to verify they worked correctly. And it thought of a lot of things I wouldn’t have, like the subtleties of the new server having an IPv6 address.

The magic thing here is how self-directed Claude/Opus was. It came up with its own idea about how to figure out what was on the server. Then came up with its own tests, like a complete set of 150,000 URLs (from Apache logs) to verify and then a 6000 URL sample to run for development work and a 22 URL sample for a smoke test. It wanted to actually test all 150,000 for a final ch eck and I told it that was too much so it whittled it down to 17,000 URLs that would test all the important paths through the server configs.

I’m trying to think what didn’t go well and not coming up with a lot. Opus is awfully wordy though, it’s a bit exhausting to talk to. Maybe I’ll find out something big went wrong in the next few days.

I do need to double back and learn to read the nix configuration files, or at least understand them. Maybe I’ll find something awful in them but on first look they are reasonable.

If I were a working sysadmin I’d be real nervous about my job now. I guess most of them already are. There’s still room for a human in the loop, at least for now. I felt like I had to manage Claude’s work, I gave it a lot of guidance in how to do certain things, and I was riding it pretty hard to verify its work. But the job I did was more like someone managing devops folks with 5+ years experience than being that devops person. This suits me fine, but it is alarming for my industry.

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.

Being Claude’s agent

I’ve been working on a complex project where I am the agent following instructions and running commands while Claude is the planner giving high order instructions. It’s kind of fun, an inversion of the usual coding agent work pattern.

(An aside: no one can define what an “agent” is. Not even me, a 1990s PhD student in the Software Agents Group at the MIT Media Lab. But one definition is “agents are software that can do things to the outside world”. Agents edit files, or push to GitHub, or pwn a competitor’s AI company. It’s the agency that makes an agent an agent. By this definition I am the agent in my scenario.)

The project I’m working on is updating my homelab / selfhosted services on Proxmox. Mostly adding a new reverse proxy to give me better access to things. This boils down to creating and configuring a bunch of little Linux containers (caddy, authelia, homepage, ntfy, etc).

I don’t really now how to do all this, so I got Claude Opus to come up with a design that I reviewed. But I didn’t trust Claude Code to implement it. And I wanted to understand how it all worked. So I had Claude write up a very verbose tasklist for me. For the past few days I’ve been dutifully following it. I’m very slow, it’s taken me ~4 hours of actual work when Claude Code would have done it in 10 minutes. But I do understand what it’s doing.

Part of what’s been fun is duplicating some of the way software agents use scratch files as memory. I have a Claude Project with several chat sessions and some text files Claude created keeping track of state. The project has like 15 tasks, each with 3-5 subtasks, and I’ve totally lost the plot. But I trust Claude to keep track of it and every once in awhile I just tell it “ok I did task 13.3. what’s next and what do I do?”

When I work with AIs I am trying to use them as partners for thinking. Most of my interactions with AI are back-and-forth, with me reviewing what its saying and using the AI as a source of ideas and things to consider. I don’t much trust an AI agent to go off and do a complex task for me, at least not one whose result I can’t easily verify. This interactive session where I do the work feels better to me.

One problem is Claude is a never-satisfied taskmaster, it keeps adding things to a giant “backlog” new task list. This is a problem inherent with how these AIs are prompted, it keeps coming up with more things to think about. I feel a bit like Sisyphus. But Claude is pretty good about accepting when I tell it “no, I’m not doing that”.

Yuba River average temperature and flow

I love swimming in the Yuba near Grass Valley. Local wisdom is it’s not safe to swim until July 4, that’s when it’s warm and slow enough to be safe. PG&E controls the flow with a dam but seems to follow a sort of schedule. My notes are that 200 CFS is “calm” flow. I was just there at 450 CFS and it was still pretty sporty. I could have swum across but it wasn’t yet a good idea.

There’s flow data at Dreamflows and USGS. Also historical data at USGS. So I fired up Claude Code and 30 minutes and $2 later I have a serviceable graph. It’s online here.

End result: yeah, July 4 is about right.

Update

For $0.50 I added a histogram of the flow on July 4. I also added a deploy script for 10 cents. Then I spent another 20 cents making sure it was treating no data differently from zero. There’s 61 years with flow under two hundred: 20 years with flow over that.

Vibe coding notes

Another project I could have done myself but didn’t want to spend the time: Claude makes it kind of fun. This went OK at first but got in the weeds.

Claude’s first instinct was to use Python and matplotlib. Yuck. I asked it to do Javascript and it chose Chart.js. Which was fine for small data but choking on more points, so it suggested switching to uPlot. That seems to get the job done. d3.js would be nice too but is overkill for a static one-off.

I am very impressed with how Claude understands high level directives like “draw a bunch of individual thin lines for each year to show distribution”. OTOH I don’t quite trust it: I’m afraid to publish this more widely for fear something about its calculations is incorrect. I tried reviewing the code but just can’t bring myself to care enough to bother. It looks right!

Claude is great when starting de novo but gets slower and buggier with iteration. For instance it mostly converted the code from Chart.js to uPlot just fine. But one thing I wanted was to clamp the Y axis at 2000 CFS. It insisted on keeping the Chart.JS code to do that and wouldn’t update to the uPlot API until I read the docs and told it myself what it needed to do. It also made a bunch of other changes that just didn’t work. I never could get it to make the graph fill the whole width. I know some folks doing agentic coding are also building test suites and telling the agent to not commit until the tests pass, that would have been really helpful here.

I sure wish I had more confidence that this visualization is actually correct and doesn’t do something stupid like averaging missing data in as if they were zeros. That’d be the same problem with a person doing the coding but I’d trust them more.

Claude Code: no login shell for agent

Claude Code regularly runs “agents”, a fancy word for shell scripts. Unfortunately for some dumb reason they chose to run the agent in a bash login shell, which means it runs the script for all sorts of stuff you only want in an interactive shell. To stop it, I put this guard in my .bash_login.

if [[ -n “$CLAUDECODE” ]]; then
echo “Detected Claude Code. Not running login script.”
return
fi

The real problem was I had put cd $HOME in my .bash_login. Not sure why, that probably solved a problem I had 25 years ago. This was confusing the agent something awful, particularly when it was moving files around or dealing with git. It kept doing things in my home directory, potentially catastrophic!

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.

Vibe coding a Mastodon thread unroller

Just had my first experience using an AI (Claude Code) to write a whole program start to finish. See the result here.

The AI coding was amazing. With about 60 minutes of “work” and $5.50 I had my result. (I then spent another 30 minutes and $3 tinkering without much improvement.) It would have taken me 4+ tedious hours to do this myself and while my resulting code would probably be better, the AI code was more than adequate for my one-off needs.

A key part of this project’s success is how simple it was. It was a Python program to download some data from a Mastodon server and format it as HTML. I could just look at the HTML output and decide if it was working. I didn’t even bother reading the Python code the AI generated. If I cared more about what the system itself was doing, how the Python script worked, it would still have been useful but taken a lot more work on my part to review everything.

I’ve been using LLMs for awhile now in chat interfaces and am impressed with them, but they are clearly just stochastic parrots, text prediction machines. Claude Code felt different. It’s still mostly an LLM but it has enough of a reasoning engine in it that I could give it high level instructions and it’d figure things out on its own. That’s really impressive to me.

I don’t think AIs are going to replace human programmers entirely anytime soon. Part of why this project went so well is I have some expertise in this kind of thing, so I knew how to tell it to (say) cache all the data from Mastodon once up front and then generate HTML locally. Or to rewrite images to make them smaller. That’s hard-won knowledge from years of building systems. But the actual scutwork of looking up Mastodon APIs and remembering how to resize images in Python? Claude did that just fine.

Anyway I’m sold on vibe coding, at least for a certain kind of workaday code where you can easily inspect the output and decide it’s good enough. And you don’t care how good the code is. I’m certain there’s still plenty of need for human expertise for more important or complicated systems but this AI experience was very impressive.

The application

I took a trip to SE Asia recently and used Mastodon to share a bunch of postcards as a Mastodon thread. Now that I’m home I wanted a nice static copy of all that easy to view and share forever. There’s a bunch of Mastodon thread unrollers but I didn’t like the output of any of them.

Here’s the HTML output Claude and I produced. I’m pretty happy with it!

That’s the final output, the customer deliverable. It looks good! Even better the HTML it generated is quality. Reasonable semantic HTML, simple structure, nothing too stupid in it. That’s better than any other automated tool I’ve ever used.

There’s also the intermediate product, the Python and shell scripts it generated. Those are also pretty good. I didn’t really read them, I’m running on vibes here, but on a quick glance it looks like reasonably OK Python code that I could understand and maintain. I would not trust Claude to do more complicated things but for this straightforward task it is good.

Claude Code even thoughtfully generates and updates a README explaining what it does. You can also get it to export a conversation of your chat log, which in some sense is the “real” programming I did.

Getting the AI to write the application

I never wrote or edited any code. I did all of this within the Claude Code shell. It wrote the code. I mostly didn’t run any code either, the agent does that for you.

High level development was in two pieces: write a Mastodon downloader to a local database, then write an HTML formatter from that local data. Then a lot of iteration, particularly on the HTML portion. I’d tell it things like “change the layout so images are only one column” or “change this text to a different font and color”.

Here’s the important choices I made:

  1. I broke the project into two parts: download the Mastodon data from the API to local disk, then generate HTML on local disk. That’s an important pattern for projects like this, it lets you iterate on the HTML presentation much faster without spamming the API.
  2. I told Claude to write simple static HTML. These tools have an alarming habit of bringing in React and other Javascript garbage.
  3. I tried out a couple of strategies to make the pages smaller, finally settling on using downsampled JPGs. I’m not sure if Claude would have thought to suggest that, I wish I’d asked!
  4. About a quarter of the way into the project I thought to ask Claude to use git. It happily did so, checking in code as appropriate.

I’ve got the conversation stored away (well most of it, it got “compacted”). Here’s some key prompts I gave it:

I want to write a Python script that downloads a bunch of posts from my Mastodon account. I want it to download a single thread: my original post and all of my replies, about 100 of them. Every post contains photos or videos that should also be downloaded. I want you to keep the original JSON data from the Mastodon API and also extract everything into a simple sqlite database with columns for post timestamp, post text, and references somehow to the images in the post. the images are important!

you’ve made two errors already converting datatypes. did you make any others? think hard about the code you wrote and try to fix anything else before I run it again

now I want you to make a nice HTML view of all the posts and pictures from the mastodon thread that I downloaded. I want the output HTML to be a simple static HTML file without any javascript dependencies, no frameworks, definitely no react. it should have minimal CSS styling but something that looks nice and modern. The images are most important, I want to be sure they look good. the images have alt tags on them in the mastodon posts, those shoudl be displayed as captions. And I want you to generate all this HTML from the downloaded files, do not make any requests on the Internet like to the Mastodon API. can you do that? tell me how you will proceed before doing it so I can review.

I ran it. It only downloaded two posts: the original and one reply. but not the others. the third post is a reply to the reply, did you remember to recurse and load the thread?

can you write code to generate smaller images to save bandwidth? ie, resize the original JPGs to new JPGs which aren’t bigger than 800 pixels. I also want it so if the user clicks on one of the JPGs in the HTML view, it links to the full size image. it can just link directly to the JPG, don’t need an HTML page for each full size image. write code to generate the smaller files, alter the HTML generator to use those files, and alter the deploy script to deploy both the smaller JPGs and the originals to my server.

Some observations

Some interesting things Claude did:

  1. It made a couple of errors converting types from JSON output (numbers to strings, datetimes). I fixed those one at a time and got annoyed so I scolded it and told it to look at its own code and fix any other errors. It made some more changes I didn’t review, and the resulting code worked first time.
  2. I asked it to download a font from Google Fonts and use it locally. It tried to download it with curl and was blocked (a security policy in the Claude agent?) So then it just wrote a Python script to download the fonts instead and ran it. It’s hacking its own sandbox!
  3. Its first attempt to download fonts failed, wrong URLs. It detected the errors and did something itself to find the correct URLs and ran the download a second time. That also had one error for one font variant and it realized it didn’t need it so just ignored that error.
  4. It got confused with HTML templates and Javascript, some sort of problem with { quoting. It sort of hacked its way into fixing it just like a junior programmer would. It got there in the end!
  5. It did OK with an open ended “can you think of anything to improve”. It suggested adding some good generic HTML things like ARIA tags, print CSS, lightbox view, social media sharing. It also suggested adding map integration or location tags to the posts, a very thoughtful suggestion for my travel app!

I don’t love the Claude Code UI. It’s some terminal UI thing and very chat-oriented. I think the VS.Code integrated tools like Cursor are probably better for more careful coding. OTOH this worked well for my one-off task. I like how Claude Code has a very agent-centric design, it’s actively doing things on your behalf. It’s much more like giving instructions to a junior programmer rather than having someone pair programming with you making suggestions.

A good Claude programming example

I’ve been having such a good time using Claude 3.5 Sonnet to help me program and learn APIs I’m not good at. See this transcript for an example, where Claude walks me through setting up a basic Python command line project, then adds pytest to it, then adds click, then makes it work in VS.Code

I taught myself how to do all these tasks three months ago. But it was a tedious process of finding the right updated docs, then experimenting a lot, and in the end not quite getting it right. A typical pre-AI programming experience. It did only take me an hour or two, and thirty minutes the second time, but still it was tedious.

Claude just magically gives me the answers. Here’s the catch: I’m not certain they’re right. I didn’t review this transcript closely or run the code. I did read it all though, and it is plausible. I am confident I could start with what Claude did for me, maybe fix a few little problems, and have a working thing. But it’s very important an expert programmer still be in the loop, you can’t just trust the code it emits. I’m fine with that, it saved me a lot of time.

What’s remarkable is it gets so many core concepts I learned three months ago right:

  • the file structure with src/hello_world_cli/__init__.py and tests/
  • the contents of pyproject.toml
  • using optional dependencies for pytest, etc
  • the structure of a decent README.md
  • click’s decorators for CLI programs, including an example of a switch
  • the use of CliRunner to test click commands in pytest
  • the need for a __name__ block to make it run under VS.Code debugger
  • it even incremented the tool version number after making changes!

It even taught me some new tricks:

  • using tool.pytest.ini_options to set up paths
  • using hatchling instead of setuptools
  • creating a launch.json file for .vscode

I know that all that’s happening behind the scenes is a very big neural network is predicting token outputs. But what it looks like to me is Claude knows a lot about programming including the use of several complex open source tools. And I can mostly chat with Claude pretending it is intelligent and understands what I’m asking and it will give me useful answers.

The limitation is I asked it precise questions about a relatively basic thing with a whole lot of good code examples and docs on the Internet. It wouldn’t do nearly as well with some more obscure libraries for which there are no good examples. It will have a harder time with more complex code. And it certainly won’t invent new things, Claude is not going to create a new algorithm for distributed consensus or something.

But for basic stuff it sure is a lot better than doing Internet searches and reading through docs and example code myself. It makes programming way more fun for me by eliminating a lot of tedium.