Blog

  • Spring-Cleaning My AI Assistant’s Memory

    Spring-Cleaning My AI Assistant’s Memory

    In What I Have Built With Claude Code (So Far) I listed one of my ground rules as “Claude keeps its own memory of decisions, gotchas and things I’ve told it not to touch, so each new session doesn’t start from scratch.” That rule has worked well. Almost too well: by late November the memory on my Raspberry Pi had grown big enough that it was quietly starting to forget things.

    This post is about how that memory works, the first time I sat down and spring-cleaned it, and what I put in place so that it doesn’t get into the same state again.

    How Claude Code remembers things

    Each Claude Code session starts with no recollection of the last one. To get round that, Claude keeps a folder of small Markdown files on the Pi, one fact per file. Some are about me and how I like things done, some are feedback I’ve given it, some describe ongoing projects and some point to where things live. Examples of the kind of thing in there:

    • Gotchas. The newer version of Pi-hole ignores the old file that DNS records used to be kept in, so records have to be added through its API instead.
    • Things to leave alone. A service I stopped on purpose, which shouldn’t be restarted or reported as broken.
    • Things that look like bugs but aren’t. An automation that emails me from my own address will legitimately show up twice in Gmail.

    Alongside the files there is an index, MEMORY.md, with one line per memory. The index is loaded into every session, and Claude opens the individual files when a line looks relevant. That makes the index the important part, and it has a limit: it gets cut off at about 24.4KB.

    The problem: it had started forgetting

    When Claude audited its own memory on 26 November, it found:

    • 77 memory files, all of them listed in the index.
    • An index of just over 24KB, right at the limit. It had already lost its last line, silently.
    • Long index lines. 35 of the 95 lines were over 250 characters, because history and “since…” notes had crept into what should have been one-line hooks.

    Nothing had visibly broken. That is what made it worth fixing: a memory that drops its last line without telling anyone fails in exactly the way you won’t notice.

    The first memory review

    I asked for a way to keep the memory relevant and current. What came out of it is a review page in my Obsidian vault, in the same tick-box style I already use for tidying Flickr. Claude checks four things and lists each proposed change with a tick box:

    • Is it still true? Paths, services and claims checked against what is actually on the Pi.
    • Is it already written down somewhere else? If a fact is in the project instructions file (CLAUDE.md) or a README, the memory is just a second copy that can drift.
    • Do two memories cover the same thing? If so, merge them.
    • Is the index too long? Every line should be a short hook, with the detail kept in the file.

    There was also a “still wanted?” section for things only I could decide. I ticked what I wanted, told Claude to “apply the memory review”, and it made only the ticked changes. Before deleting anything it had to check whether the memory held a fact that wasn’t recorded anywhere else and, if so, move that fact first.

    Some of what it found:

    • Stale facts. A memory said not to edit a config folder that no longer existed. Another described a project as “not yet scheduled” when it had been running weekly for over six weeks. Another said a set of connectors was “configured but disabled”, when several were now connected; that one was simply deleted, because every session already lists the tools it has.
    • Broken links. Memories link to each other, but 46 of them had the wrong name in their header, so links to them didn’t resolve.
    • Duplicates of the instructions file. Several memories, and several lines of the index, just repeated what CLAUDE.md already says.
    • Things spread too thin. Everything about one Gmail project was split over four places, and my “definition of done” over three memories. Each became a single memory.

    The suggestion that was wrong

    One item was a good reminder of why I tick the boxes myself rather than letting it tidy unsupervised. The review proposed deleting a paragraph that warned a particular change hadn’t been deployed yet, because that commit was no longer in the project’s repository.

    When it came to applying it, the reason turned out to be wrong. That commit belongs to the Windows version of the same tool, which lives in a separate repository and still has it. Claude had checked the wrong repo. So the paragraph wasn’t deleted; it was shortened to say that Windows deployments need a manual pull, which can’t be checked from the Pi.

    Nothing was lost, but only because the “apply” step re-checked each change instead of trusting the review.

    The result

    • 77 memory files became 68.
    • The index halved, to 12,191 bytes, with no line over 200 characters.
    • Nothing worth keeping was thrown away. For example, the notes from my Evernote migration moved out of memory and into that project’s README, which is where they belonged in the first place.

    Putting the memory in git

    There was one uncomfortable detail. The only backup of the memory from before the review was a temporary folder. I keep everything else on the Pi in git, so the memory got the same treatment the same day:

    • A private GitHub repository. The first commit is the memory exactly as it was before the review, and the second applies the review, so the review itself can be read back or reverted.
    • A commit at the end of every session. A small script, ClaudeMemorySync, runs from a hook when each Claude Code session ends, including the headless ones on timers. It commits whatever changed, names the changed files in the message and pushes. A lock stops two sessions that end together from colliding, and a failed push is retried next time. By the time this draft was written, it had already committed changes from later sessions on its own.
    • Backup, not sync. My other Claude Code setup syncs agents and commands between the Pi, my Windows PC and my Chromebook, but it still deliberately doesn’t sync memory between machines.

    Keeping it tidy

    The point of all this is that I shouldn’t need to notice the problem next time. Two things look after that:

    • A regression test. Like every other service on the Pi, the memory now has a test in my regression suite. It fails if the index goes over 20KB (leaving headroom below the cut-off), if an index line is over 250 characters, if a link or a name doesn’t match, if the index and the files disagree, if a memory change has gone uncommitted for more than a day or hasn’t been pushed, or if the end-of-session hook has gone missing. While a review is open, the size and format checks are skipped, but only until a fixed date, so an abandoned review can’t hide them forever.
    • A reminder every 90 days. Ninety days after the last review, a link appears in my Daily note. Clicking it opens the review page, and telling Claude to “review memory” produces a fresh list of tick boxes. The next one is due on 24 February 2027.

    What I’ve learned

    • Memory needs maintenance like everything else. It grows one sensible addition at a time, and nobody notices it getting stale until something is quietly missing.
    • Know your limits, literally. The cut-off was the real problem, and the test now keeps a margin below it.
    • One fact, one home. Most of the clean-up came from facts that had been written down in two or three places. If something is in a README or the instructions file, it doesn’t need to be in memory too.
    • Keep a human in the loop for deletions. The tick-box page plus a re-check before applying caught the one wrong suggestion.
    • Put it in git. Anything worth cleaning up is worth being able to roll back.

    A note on how this post was written: it was drafted by Claude Code, which went through the repos, code history and vault notes for the memory review and the memory backup, and wrote the draft directly into WordPress as a draft through the WordPress API. The header image was generated with Google’s Gemini image model. I then reviewed and edited it before publishing.

  • Lucky Imaging the Moon: My Seestar Pipeline Leaves Deep Space

    Last week’s post about my Seestar pipeline’s first fortnight ended on a cliffhanger, of sorts. The pipeline had just been taught to handle the Moon, the Sun and Jupiter, and I said I’d find out whether it worked once the first video had been through.

    It did. In the week since, three Moon images have come out the other end, all made from videos the Seestar S50 recorded, and all of them now on Flickr and my astronomy site, vividgrey.co.uk. This post explains why the Moon needed a different approach from the galaxies and nebulae, how that approach works, and what came out.

    Why the Moon is different

    For deep-sky targets the Seestar saves thousands of ten-second exposures, and my Windows PC stacks them in Siril. Siril lines the frames up using the stars, which works beautifully for a galaxy surrounded by a star field.

    The Moon, the Sun and the planets are different in two ways:

    • They’re recorded as video. The Seestar saves an MP4 rather than individual frames, at around 30 frames a second, so even a short clip holds thousands of frames.
    • There are no stars to align on. Siril’s registration is star-based only. Its own help text says the algorithm “only works with deep sky images”, and there’s no planetary or multi-point alignment I could run from a script.

    So instead of bending Siril to do something it wasn’t built for, Claude Code wrote a small separate step in Python, using OpenCV and NumPy. It’s the first part of the PC side that isn’t plain standard-library Python, so it runs in its own virtual environment, and the main script calls it as a separate process. The deep-sky pipeline is untouched.

    How lucky imaging works

    “Lucky imaging” is the standard trick for the Moon and planets. Looking through the atmosphere is like looking through the bottom of a moving swimming pool: most frames are smeared, but every so often the air steadies for a moment and you get a sharp one. Record enough frames, keep only the lucky ones, and stack those.

    The new step does exactly that, in five stages:

    • Score every frame. Each frame gets a sharpness score (the variance of the Laplacian, which is a measure of how much fine edge detail there is).
    • Keep the best 10%. With a minimum of 30 frames, for very short clips. The sharpest frame of all becomes the reference.
    • Align them, twice. First each frame is shifted as a whole to match the reference, using phase correlation. Then, because the atmosphere distorts different parts of the disc in different ways, it’s refined locally: a grid of 128-pixel alignment points, every 96 pixels, each matched on its own. The resulting map of small shifts is smoothed and used to warp the frame into place.
    • Average. The aligned frames are averaged, which smooths out the noise and the video compression blockiness.
    • Sharpen. A three-scale “wavelet” boost brings out the detail the averaging has recovered, and the result is saved as a JPG and a 16-bit PNG.

    It also saves a single frame of median quality next to the stack, so I can compare what one typical frame looked like with what the stack achieved. That comparison was the first test: on a short Moon video from May it kept 410 of 4,100 frames, and the stack was clearly sharper and less blocky than the typical single frame.

    Fitting it into the pipeline

    The stacking was the interesting part, but most of the work was making it fit the pipeline I already had without breaking anything:

    • Deep sky comes first. Each Tuesday and Friday run still processes its deep-sky target, then does one video, so the deep-sky queue isn’t held up. The largest video goes first, because it has the most frames to choose from.
    • Every video is remembered. Once a video has been stacked, its file name is added to that target’s note in my Obsidian vault, so a new recording of the same object is picked up later rather than ignored.
    • The Pi had to learn a new format. The Raspberry Pi that uploads to Flickr and drafts the vividgrey post expected deep-sky details: filters, nights, the number of stars used for colour calibration. A video has none of those, and the old code would simply have crashed on one. It now recognises a video result and writes a different title, description and details table: when it was captured, how long the video was, and how many frames were kept.
    • Switched on in the right order. The PC side was built with the video step turned off. Only once the Pi side was updated and its tests passed was it switched on, late on 21 November.

    Comets are still left out, because they move against the stars and need a different kind of alignment again, and the planets’ still frames aren’t stacked yet. When the step was switched on there were ten videos waiting: four of the Moon, two of the Sun and four of Jupiter.

    The first three Moons

    Last week I expected the first result after Tuesday’s run. In the end it turned up a day earlier, on Monday morning, and it wasn’t one of the ten in the queue.

    A waxing gibbous Moon against a black sky, with craters and dark maria visible across the lit side
    Waxing gibbous Moon, 21 November 2026: the best 10,353 of 103,534 frames from a 57-minute video.

    21 November 2026. While the video step was being written, the Seestar was out recording the waxing gibbous Moon, starting at 22:08. That video, nearly an hour long, was bigger than anything in the queue, so it went first. The stack used 10,353 of its 103,534 frames, and it was on vividgrey on 23 November.

    A warm-toned full Moon against a black sky, with bright ray systems spreading out from a crater near the bottom of the disc
    Full Moon, 8 August 2025: the best 4,147 of 41,471 frames from a 23-minute video.

    8 August 2025. This was the video the pipeline was expected to start with, a 23-minute recording of a full Moon. It arrived on Wednesday 25 November, from Tuesday’s run, alongside M 42, the Orion Nebula. 4,147 of 41,471 frames were kept. A full Moon is lit straight on, so there are few shadows, but the bright rays thrown out from the younger craters show up well.

    A gibbous Moon against a black sky, with sharp craters along the shadow line on its left-hand edge
    Gibbous Moon, 1 November 2025: the best 1,208 of 12,079 frames from a video under seven minutes long.

    1 November 2025. The third came from Friday’s run and arrived on Saturday 28 November, with M 31, the Andromeda Galaxy. It’s the shortest of the three, 6 minutes 43 seconds, and 1,208 of 12,079 frames went into the stack. Even so, the craters along the shadow line are crisp.

    All three went through the same review step as the deep-sky images: a draft on vividgrey and a checkbox in my Daily note, and nothing goes public until I’ve looked at it.

    Next: the Sun and Jupiter

    The Sun and Jupiter videos are still in the queue, and they’ll be the real test. The Moon fills a good part of the frame, so the local alignment points have plenty to work with. Jupiter will be a small disc. For a small object the code scores only a box around it rather than the whole picture, and anything under 400 pixels across is aligned as a whole, without the local alignment points. I’ll find out how well that works when the first one comes through.

    What I’ve learned

    • Don’t force a tool past what it’s for. Siril is excellent at deep sky. A couple of hundred lines of Python and OpenCV turned out to be easier than trying to make it do planetary work.
    • Turn things on in the right order. Building the video step switched off, and only turning it on once the Pi could cope, meant the first video went straight through rather than failing in the middle.
    • Keep a comparison frame. Saving a typical single frame next to every stack makes it obvious whether the stacking has actually helped.
    • The newest data can jump the queue. Choosing by size rather than by date meant the video I recorded on the night it was switched on became the first image out.

    The deep-sky pile is still shrinking twice a week, and now the Moon is coming along with it.

    A note on how this post was written: it was drafted by Claude Code from the AstroProcessor and AstroPublisher repos, their code history and my vault notes on the pipeline and the Moon, and written into WordPress as a draft through the API. Claude chose the photos from my Flickr account. I reviewed and edited it before publishing.

  • Five Images in Two Weeks: My Seestar Pipeline’s First Fortnight

    A week ago I wrote about my Seestar pipeline going live: my Windows PC stacks the telescope’s frames in Siril, and the Raspberry Pi uploads the result to Flickr and drafts a post on my astronomy site, vividgrey.co.uk. At the time it had produced two images, the Whirlpool Galaxy and the Pacman Nebula.

    It’s now been running for two weeks, so this is a short follow-up on what it has actually done, rather than what it was designed to do. The short version: five finished images, four of them published, and very little effort on my part.

    The first fortnight in numbers

    Each run on the PC processes one target, picking the deep-sky object with the most unprocessed data. Here is what came out:

    • M 51, the Whirlpool Galaxy (8 November): 4,628 frames, 12 hours 52 minutes, published 9 November.
    • NGC 281, the Pacman Nebula (10 November): 2,002 frames, 5 hours 34 minutes, published 12 November.
    • IC 434, the Horsehead Nebula region (14 November): 1,617 frames, 4 hours 29 minutes, published 15 November.
    • M 81, Bode’s Galaxy (17 November): 1,149 frames, 3 hours 11 minutes, published 19 November.
    • M 13, the Hercules Cluster (20 November): 825 frames, 2 hours 17 minutes, waiting for me to review.

    That’s 10,221 ten-second frames, a little over 30 hours of light, all taken with the Seestar S50 between April 2025 and April 2026 and sitting on the NAS until now. Every image was colour-calibrated with Siril’s SPCC against the Gaia star catalogue, using anything from 115 stars (M 51) to 1,239 (NGC 281).

    The new arrivals

    The first two images were in the last post, so here are the three that have arrived since.

    The dark silhouette of the Horsehead Nebula against a faint red glowing cloud of gas, with a bright star at the top of the frame
    The Horsehead Nebula region (IC 434): 1,617 frames from nine nights, 4 hours 29 minutes in total.

    IC 434 is the glowing cloud in Orion that the dark Horsehead Nebula stands out against. The Seestar had captured 2,216 frames over nine nights between December 2025 and March 2026. 1,806 of them aligned and 1,617 made it through the filters into the final stack, calibrated against 232 stars. The horse’s head is small in the Seestar’s field of view, but it’s unmistakable.

    Bode's Galaxy, a bright oval spiral galaxy with a glowing core, in the centre of a field of stars
    Bode’s Galaxy (M 81): 1,149 frames from two nights, 3 hours 11 minutes in total.

    M 81, a spiral galaxy in Ursa Major, shows one of the pipeline’s limits. My notes list ten nights on it, but on eight of those the Seestar only kept its own stacks, not the individual frames, so Siril could only use two nights: 1,149 of 1,325 frames, calibrated against 184 stars. The background also isn’t perfectly even, which is something to look at in the processing later.

    The Hercules globular cluster, a dense ball of thousands of stars, in a star field with a small faint galaxy above it
    The Hercules Cluster (M 13): 825 frames from three nights, 2 hours 17 minutes in total.

    M 13 is a globular cluster, a dense ball of stars rather than a galaxy or a nebula, and the first of its kind through the pipeline. 825 of 1,074 frames from three nights in 2025 were stacked, calibrated against 339 stars. Its vividgrey post is still a draft while I look at it.

    Twice a week, and a missed Friday

    The PC job started as Friday only. On 9 November, the day after the first run, I added a Tuesday run as well, so images arrive twice a week. The Pi didn’t need a new schedule, because it already checks for new images every morning at 07:30. Its “no new image” check, which used to run only on Saturdays, now also runs on Wednesdays, and the message names the run it was expecting.

    That check has fired once so far. On Saturday 14 November my Daily note said there was no new image from the PC’s Friday run and asked whether the PC had been switched on. IC 434 was then processed later that Saturday, and the Pi picked it up on Sunday morning. Since then the Tuesday and Friday runs have both delivered on time.

    The PC side runs only while I’m logged on, because it needs the vault and the NAS, and the scheduled task is set to run as soon as possible after a missed start. That’s the price of doing the heavy work on a desktop rather than a server, and so far it’s a price I’m happy to pay.

    The review reminder

    Nothing goes public on vividgrey until I press Publish, so the pipeline has to make sure I actually do. When the Pi creates a draft, it adds a checkbox to that day’s Daily note telling me to review and publish it, with edit and preview links. If the post is still a draft a week later, the reminder comes back, and it keeps coming back every seven days until I publish. Once I have, the next run marks the target’s note as published, with the date and the URL.

    So far the repeat hasn’t been needed: each of the first four drafts was published within a day of appearing. Having the to-do sitting in the note I open every morning turns out to be most of the battle.

    Faster than expected

    In the last post I said that copying the frames from the NAS was the real bottleneck: for M 51 it took 84 minutes, against 207 minutes in Siril. M 51 turned out to be the extreme case, because it has by far the most data. The later targets were much quicker:

    • NGC 281: 16 minutes copying, 122 minutes stacking.
    • IC 434: 14 minutes copying, 99 minutes stacking.
    • M 81: about a minute copying, 39 minutes stacking.
    • M 13: about 2 minutes copying, 14 minutes stacking.

    Because the job always takes the target with the most data first, each run should be a bit quicker than the one before, at least until I capture something new.

    Next: the Moon, the Sun and Jupiter

    Until now the pipeline only handled deep-sky objects. The Seestar records the Moon, the Sun and the planets as video rather than as individual frames, and Siril’s alignment only works with stars, so it can’t stack them from a script.

    On 21 November Claude Code added a separate “lucky imaging” step on the PC, written in Python with OpenCV. It scores every frame of a video for sharpness, keeps the best 10%, aligns them, averages them and sharpens the result. In a test on one of my Moon videos it kept 410 of 4,100 frames, and the stack was clearly sharper than a typical single frame. The Pi side was updated the same evening to build the right Flickr description and post for a video (capture date, video length, frames kept) instead of the deep-sky details.

    • One video per run. Each Tuesday and Friday run now does its deep-sky target first and then one video, so the deep-sky queue isn’t held up.
    • Ten videos waiting. Four of the Moon, two of the Sun and four of Jupiter. The largest goes first, which should be a Moon video from August 2025.
    • Turned on carefully. The video step was switched off until the Pi could handle its output, because otherwise the publisher would have failed on it. It was only switched on once that change was in.

    The first solar-system image should arrive after Tuesday’s run. I’ll find out on Wednesday morning whether it worked.

    What I’ve learned

    • Running it beats designing it. Two weeks of real runs told me more about copy times, missing frames and missed schedules than any amount of planning would have.
    • The checks earn their keep. The “no new image” message caught the missed Friday the first time it could have.
    • A reminder in the right place is enough. I didn’t need anything clever to get drafts published, just a checkbox in the note I already read every day.
    • Old data is worth revisiting. Every one of these images came from frames I’d captured months ago and never done anything with.

    The pile isn’t gone yet, but it’s shrinking twice a week.

    A note on how this post was written: it was drafted by Claude Code from the AstroProcessor and AstroPublisher repos, their code history and my vault notes on the pipeline and each target, and written into WordPress as a draft through the API. Claude chose the photos from my Flickr account. I reviewed and edited it before publishing.

  • Tidying Twenty-Six Years of Flickr, One Tick Box at a Time

    A few weeks ago I wrote about On This Day, which puts old Flickr photos back into my Daily note every morning. Looking at those photos every day had a side effect: I kept noticing how badly kept my Flickr account is. Most of my photos still titled with the camera’s file name, no descriptions, no tags, hardly any of them in Flickr groups where other people might actually see them, and an album list full of Title, Title (1) and Title (2) sets left behind by old upload tools.

    Tidying that by hand was never going to happen. So last Sunday I asked Claude Code to help, and a week later I have a project called FlickrMaintenance and a page in my Obsidian vault that I work through a few minutes at a time, one tick box at a time.

    The idea: Claude suggests, I tick

    The whole thing runs on one rule: nothing changes on Flickr until I tick a box. Every morning at 07:40 a job on the Raspberry Pi looks at photos that need attention and writes its suggestions into a vault page called Flickr Maintenance. Each suggestion is a task line. When I agree with one I tick it, and the next run carries it out and removes the line. When I don’t, I mark it as cancelled or just delete the line, and that suggestion is never offered again.

    The page only ever shows what’s outstanding. There’s no history to scroll through, so if it’s short, I’m caught up. When something is waiting, a one-line section in that day’s Daily note links to the page with a count, right under the On This Day photos.

    What it looks at

    • New uploads. Anything that has arrived on Flickr since the last run, whether from my phone, my telescope pipeline or by hand. A day with more than 30 uploads is treated as a bulk dump and skipped, because most of those are my old library being imported.
    • Photos I’ve used. Photos used in a blog post, on my astrophotography site or in On This Day. If one of those isn’t public yet, it’s listed under Make public first.
    • Older photos in no groups at all. A slow trickle through the back catalogue: a few a day, newest first, so the backlog never swamps the page.
    • Bulk upload days. Shown one at a time. If I tick a day, its photos join the back-catalogue queue with a larger allowance.

    How Claude picks groups

    Flickr groups are where photos get seen, but finding the right ones is tedious. The job does it in four steps:

    • Look at the photo. A headless Claude session reads the image itself, along with its title, tags, description and location, six photos at a time. It describes what’s in each one and writes a few search phrases for groups. It can read files and nothing else.
    • Search Flickr. The job runs those searches and throws out invitation-only, adult, dead and photo-banning groups, plus small groups I’m not in.
    • Choose. A second Claude call, with no tools at all, picks up to five groups per photo from the groups I’m already in plus the search results. It prefers my own groups, is told that fewer good groups beat filler, and points out any group rule I need to follow, such as a required tag.
    • Show it on the page. Each line says whether I’m already a member (a green icon, so ticking adds the photo straight away) or need to join first (orange). The script never joins groups for me.

    Groups don’t always say yes. Some refuse photos with Flickr’s unhelpful “Content not allowed” error. My first guess was that they wanted geotagged photos, but one group refused ten photos, nine of which were geotagged, so that wasn’t it: the error just means the group’s admins have blocked the photo, and Flickr doesn’t say why. Now, once a group has refused two different photos, it’s never suggested again. Groups whose rules can’t take a photo at all, such as a video for a photos-only group, are filtered out before they reach the page.

    The other surprise was posting limits. Plenty of groups only allow a couple of photos a day or five a week, so a ticked line can be held back. Those lines stay ticked with a note, and a second timer retries them every three hours until they go through. It doesn’t call Claude, and when nothing is waiting it exits straight away.

    Rename and tag

    The same pass over the image also suggests a proper title, a short factual description and five to ten tags. On the page it looks like a small block I can edit before ticking. If I change the title or tags, the run sends what the page says, not what Claude suggested.

    • Camera file names become tags. If a photo was titled something like P7080815, that name is kept as a tag, so I can still find it by the original file name.
    • Tags are only ever added. Nothing already on the photo is removed.
    • Every change can be undone. The old title and description are recorded before anything is sent, and one command puts them back.
    • No guessing who’s who. People are only named if they’re already named in the photo’s own tags, title or description.
    Black and white photo of a loch under heavy storm clouds, with ducks on the water and a gravel shore in the foreground
    Storm clouds over the loch at Strathclyde Park. Until this week it was called P7080815.

    More pages, same rules

    Once the main page worked, the same tick-box pattern grew into a few more pages during the week, all sharing one set of code so the ticks mean the same thing everywhere:

    • Photo Days. A list of every date I’ve taken photos on. Tick a day, or type a date in, and over the next few runs every photo from that day gets rename suggestions, plus ticks to make it public, delete it, or ask for groups.
    • Photo Groups. Paste a link to any of my photos and the next run suggests ten groups for it, along with a title, description and tags.
    • Photo Search. Finds my public photos by black and white, views, favourites, comments or a plain-English search, and can draft a blog post about a photo I tick.

    Once a photo’s details have been sent or declined on any page, no page suggests them again, so I’m never asked the same question twice. These three run straight after the main job each morning.

    Untangling 719 albums

    The albums were their own mess. A separate page lists all of them alphabetically with their counts, and groups possible duplicates: titles that match once case, punctuation and a trailing (1) are ignored, or albums that share at least 80% of their photos. I can also mark my own sets by hand.

    To merge a set I tick the one album to keep. The next run copies every missing photo from the others into it, and only deletes an emptied album once Flickr shows that all its photos are in the kept one. Photos themselves are never deleted, and a deleted album’s details are recorded so it can be recreated. Unlike the others, this page only runs when I start it rather than on the morning timer. So far it has merged away 43 duplicate albums.

    Grey metal swan sculptures on a wooden deck beside a canal basin, with a green and red narrowboat moored behind
    The swan sculptures at the Union Canal basin in Edinburgh, renamed, tagged and given a new album of its own this week.

    Keeping the AI on a short lead

    Giving an automation write access to twenty-six years of photos made me nervous, so the design leans hard on narrow tools:

    • Claude never touches Flickr. It only looks at images and writes suggestions. Everything that changes Flickr is ordinary Python, and only runs for a line I’ve ticked.
    • One small tool per kind of change. All reads go through the same shared, read-only Flickr client that On This Day uses. Each write has its own small script that can call only one or two Flickr methods: one adds a photo to a group I’m already in, one sets titles and adds tags, one makes a photo public, one handles albums.
    • Deletes are guarded. Deleting a photo is permanent on Flickr, so it needs a separate permission, contradictory ticks do nothing, and photos used on either of my blogs can’t be deleted at all.
    • Safe to re-run. If a run fails partway, whatever it had already done is saved and the page is left alone. If I edit the page while a run is going, my edits are merged in rather than overwritten.

    The first week in numbers

    The main page keeps running totals in its properties, recalculated from the run log every time. As of this morning, after 94 logged runs and no failures:

    • 515 photos added to groups, and another 37 sent to moderated groups’ queues.
    • 121 photos renamed and tagged, and just 6 rename suggestions declined.
    • 179 group suggestions declined, and 51 adds refused by groups.
    • 3,009 posting-limit retries. That’s the three-hourly timer patiently knocking on the same few doors.
    • About $10.64 of Claude time for the main page, which has looked at 169 photos.

    That only declining 6 renames out of more than a hundred is the number I like best. The suggestions are good enough that most of the time I just tick.

    What I’d take from it

    • Tick boxes beat chat. Reviewing a list of suggestions in a note I already have open takes seconds, and I can do it on my phone.
    • Let the AI look, not act. Claude is very good at describing a photo and matching it to a group. It doesn’t need permission to change anything to be useful.
    • Small, boring tools are what make it safe. Most of the week went into guard rails, undo records and edge cases rather than the clever part.

    There are still tens of thousands of photos to go, but for the first time the account is getting tidier rather than messier.

    A note on how this post was written: it was drafted by Claude Code from the FlickrMaintenance and FlickrClient repos, their code history and my vault notes, and Claude chose the photos from my Flickr account. It wrote the draft directly into WordPress through the WordPress API, and I then reviewed and edited it before publishing.

  • Stormy Skies Over the Loch at Strathclyde Park

    This is the loch at Strathclyde Park in Lanarkshire, taken on 8 July 2017 on a parkrun morning. I converted it to black and white and pushed the contrast fairly hard, as the sky suited it.

    Black and white view across a loch under dark, heavy clouds, with sunlight reflecting on the rippled water, ducks on the left, a tree-lined far shore and a gravel bank in the foreground.
    The loch at Strathclyde Park under a stormy sky, 8 July 2017.

    The clouds are the main feature. Dark, heavy banks of cloud sit over the far shore, with a bright gap between them where the sun is coming through. That light falls on the water in the middle of the frame and leaves a broad silvery patch among the ripples.

    On the left there is a loose group of ducks on the water, small dark shapes against the brighter surface. A line of trees runs along the far side of the loch, almost black against the sky, and there are a few buildings on the right-hand shore. In the foreground a gravel edge curves in from the bottom right and takes up the dark corner of the picture.

    I like how the black and white treatment simplifies the scene to three things: the sky, the light on the water and the dark ground around it.

    This post was drafted by Claude from the photo and its Flickr details, written into WordPress as a draft through the API, and reviewed by Ross before publishing.

  • Looking Up at a Cast-Iron Canopy in Larkhall

    This is a black and white photo I took in Larkhall on 30 December 2016. I was looking straight up at the underside of an ornate cast-iron canopy, with a pale, plain sky behind it.

    Black and white view looking up at a circular cast-iron canopy, with ribs radiating from a central hub and decorative scrollwork silhouetted against a pale sky.
    Cast-iron canopy from below, Larkhall, December 2016.

    The canopy is built around a solid round hub at the centre. From there, a dozen or so ribs spread out to the edges like the spokes of a wheel. Between the ribs the ironwork is filled with scrolling, leaf-like shapes, and the gaps between them let the sky through.

    Because the sky is so even and light, everything solid has come out as a flat black silhouette. That suits the subject. You lose any detail of paint or rust and are left with the shapes alone, which is what I like most about it. The symmetry does most of the work.

    Larkhall has its share of Victorian-style ironwork, and it is easy to walk under this sort of thing without looking up. Pointing the camera straight overhead turned it into a pattern I might otherwise have missed.

    This post was drafted by Claude from the photo and its Flickr details, written into WordPress as a draft through the API, and reviewed by Ross before publishing.

  • From Pile to Picture: My Seestar Pipeline Goes Live

    Last week I wrote about cataloguing everything my Seestar S50 has captured: 65 targets, about 77 hours of data, and a list of next steps that I described as “ideas at this stage rather than anything built”.

    That didn’t last long. Two of those ideas, proper stacking on the PC and publishing to my astronomy site, were built the same weekend and went live on 8 and 9 November. Since then two finished images have gone from a pile of 10-second frames on the NAS to published posts on vividgrey.co.uk, and the only thing I did by hand was press Publish.

    First, was it worth it?

    Before building anything, I had Claude Code do a proof of concept on the obvious candidate, the Whirlpool Galaxy (M 51), which is almost a quarter of everything I’ve captured. The question was simple: does stacking many nights together in Siril beat the Seestar’s own best single-night stack?

    • A two-night test first. Two nights in May 2025 stacked in under two minutes. The detail was about the same as the Seestar’s stack from one of those nights, but Siril’s rejection removed a satellite trail that the Seestar had kept.
    • Then everything. 6,254 sub-frames went in and 4,628 were stacked, about 12.9 hours of light. 792 frames failed to align and 834 were thrown out by a filter that rejects stars that aren’t round.
    • The comparison. Against the Seestar’s best stack (1,362 frames, about 3.8 hours), the spiral arms are better defined, the faint plume of material around its companion galaxy NGC 5195 shows up, and there are more faint stars. The Seestar’s version has a slightly darker background, to be fair to it.

    The verdict was “worth automating”, so we did.

    The PC half: AstroProcessor

    Siril would run on the Raspberry Pi, but the Pi is already busy with everything else, so the heavy lifting happens on my Windows PC. AstroProcessor is a Python script (standard library only) that Task Scheduler runs every Tuesday and Friday at 20:00. It started as Friday only; I added Tuesday the next day so that images arrive more often.

    Each run processes exactly one target:

    • It picks the target. It reads the Astronomy notes in my Obsidian vault and looks for deep-sky objects (not stars, planets, the Moon, the Sun or comets) that haven’t been processed yet and have at least an hour of frames. The one with the most integration wins. If a target was shot through more than one filter, only the filter with the most data is used.
    • It copies the frames locally. Working directly from the NAS is too slow, and copying turned out to be the real bottleneck: in the proof of concept, copying M 51’s frames took 94 minutes and Siril itself only took 11.
    • It stacks them. Siril’s command-line version runs a script based on the official Seestar preprocessing script: debayering, two-pass registration, the roundness filter and a rejection stack that throws out outliers such as satellite trails and aircraft.
    • It finishes the image. A small crop to remove the ragged edges, background extraction, plate solving (working out exactly where in the sky the image points), and then colour calibration using Siril’s SPCC, which compares star colours against the Gaia catalogue with a profile for the Seestar’s sensor. Then a stretch, and a JPEG.
    • It records everything. Alongside the JPEG it writes a JSON file with every capture and processing detail, and updates the target’s note in the vault with when it was processed, how many frames were used and how many hours they add up to.

    The online catalogue servers Siril normally uses kept timing out, so the Gaia catalogues now live on the PC (22.4 GB of them) and everything runs offline. And in one of the first tests, colour calibration quietly fell back to none at all: the way Python is installed on that PC meant Siril couldn’t see its own saved settings. Every script now sets the catalogue locations itself, and the run falls back to a simpler calibration, then to none, rather than failing outright.

    The Pi half: AstroPublisher

    Every morning at 07:30, AstroPublisher on the Raspberry Pi looks for anything the PC has left in a “ready” folder on the NAS. Unlike a lot of my automations, there’s no AI involved at this stage. It’s a plain Python job that builds everything from the JSON file and the description in the target’s vault note. For each image it:

    • Uploads it to Flickr, public, into a Seestar S50 album, with a title, description and tags.
    • Creates a draft post on vividgrey.co.uk with the image (linked to Flickr) as both the main picture and the featured image, a short description of the object, a capture details table (frames captured, aligned and stacked, total integration, nights, exposure, gain, filter, sensor temperature, image scale, calibration and the Siril version) and a list of the processing steps.
    • Updates my notes. The target’s note gets the Flickr and draft links, and the Daily note gets a line saying what was processed plus a checkbox reminding me to review and publish the draft. If I leave it, the reminder comes back every seven days.
    • Notices when I’ve published. Once the post is live, the next run marks the target’s note as published, with the date and URL.

    It also keeps an eye on the PC. If the Tuesday or Friday run produced nothing, the Wednesday or Saturday Daily note says so, and asks whether the PC was switched on. That has already happened once: this Friday’s run produced no image, and Saturday’s note told me.

    The guardrails

    This is the same pattern as the drafts on this blog, and the rules are deliberately narrow:

    • Drafts only. The WordPress client can create a post with its status hard-coded to draft, upload new media and add missing categories and tags. It can’t publish, edit or delete anything, and its self-test checks the code for any other kind of write.
    • No accidental secrets. It refuses any content containing one of my stored credentials, or anything shaped like a key or token, and it refuses duplicate titles.
    • Flickr is add-only. The uploader only uploads new photos and never changes an existing one. Every upload is recorded by a fingerprint of the file, so the same image can’t go up twice.
    • The raw data is read-only. The Pi sees the telescope’s files through a read-only mount. The only folder it can write to is the hand-off folder.

    The first run’s bug

    The very first live run is a good example of why those rules matter. AstroProcessor stacked M 51 overnight, from 22:35 on 8 November to 03:27 the next morning, and AstroPublisher was started by hand straight afterwards.

    It failed at the Flickr step. The new uploader had created its record of uploaded photos as an empty file, and then crashed trying to read that empty file. The problem was that this happened after the upload. The photo was on Flickr, public, but not recorded and not in the album, so simply running it again would have uploaded it a second time.

    The fix was small: an empty or missing record now counts as “nothing uploaded yet”, and the self-test covers that case. The photo that had already gone up was added to the record by hand so the retry reused it, and the retry a minute later went through cleanly.

    The first two images

    The Whirlpool Galaxy, a face-on spiral galaxy with its small companion at the top of one arm, in a field of stars
    The Whirlpool Galaxy (M 51): 4,628 ten-second frames, 12 hours 52 minutes in total, stacked in Siril.

    M 51, the Whirlpool Galaxy, was the first: 4,628 frames, 12 hours 52 minutes of integration, colour-calibrated against 115 stars. I published it on vividgrey on 9 November.

    The Pacman Nebula, a reddish cloud of glowing gas with a dark lane cutting into it, surrounded by dense stars
    The Pacman Nebula (NGC 281): 2,002 frames from five nights, 5 hours 34 minutes in total.

    NGC 281, the Pacman Nebula, came from the first Tuesday run on 10 November: 2,002 of 2,564 frames from five nights between October and December 2025, 5 hours 34 minutes in total, calibrated against 1,239 stars. It was published on 12 November.

    When AstroProcessor was first set up it found 16 candidates waiting, so there is plenty in the queue.

    What I’ve learned

    • Prove it before you build it. A proof of concept on a single target answered the only question that mattered, and made all the design decisions easier.
    • Split the work where it belongs. The PC does the heavy processing; the Pi, which is always on, does the publishing and the reminding. They only talk through a folder on the NAS.
    • Not everything needs an AI at run time. Claude Code built both halves, but once the decisions were made, plain scripts were the right tool. The AI’s judgement was spent once, up front.
    • Make crashes safe, not just rare. The first-run bug was harmless because the job records each step and resumes where it stopped, and because the fix made the risky step safe to repeat.
    • Keep a human on the Publish button. I’m happy for the pipeline to choose the target and accept the processing automatically, but nothing goes public on either site until I’ve looked at it.

    Quality scoring of individual frames and a proper observing log are still on the ideas list. For now, though, the pile is finally turning into pictures.

    A note on how this post was written: it was drafted by Claude Code from the AstroProcessor and AstroPublisher repos, their code history and my vault notes on the pipeline, and written into WordPress as a draft through the API. Claude chose the photos from my Flickr account. I reviewed and edited it before publishing.

  • 65 Targets and 77 Hours: Cataloguing My Seestar S50 Night Sky

    I’ve never written about astronomy here, which is odd, because for the last year and a half one of my favourite gadgets has been a smart telescope. Since March 2025 I’ve been pointing a ZWO Seestar S50 at whatever is up and letting it do its thing, and every file it has produced has been piling up on my NAS ever since.

    This week I finally asked Claude Code to make sense of that pile. The result is a note in my Obsidian vault for every target I’ve captured, and some numbers that surprised me.

    What the Seestar is

    The Seestar S50 is an all-in-one telescope: a 50 mm triplet apochromatic lens with a 250 mm focal length (f/5), a small 2 MP Sony sensor, a motorised mount and a computer, all in one box. You choose a target in the phone app, it finds it, tracks it and takes 10-second exposures, stacking them live as it goes. There is no eyepiece. What you get is a growing image on your phone, and a folder full of files.

    It saves each individual frame as a .fit file (the FITS format astronomers use, with all the capture details in a header) along with JPEG previews and its own stacked results. That’s where the problem starts.

    The pile

    Before this week I couldn’t have told you how much I’d captured. Claude Code on my Windows PC looked at the share on the Synology NAS and came back with:

    • 24,857 .fit files, taking up 98.2 GB
    • 49,802 JPEGs, another 20 GB
    • 44 videos and a handful of other files, for about 119 GB in total
    • 118 folders, all at one level, because the Seestar makes separate folders for each target’s stacks, sub-frames, mosaics, photos and videos (M 31, M 31_sub, M 31_mosaic and so on)

    Once you fold those variants together, that’s about 65 distinct targets. Nobody is going to look through that by hand, least of all me.

    One note per target

    The vault already has a note per camera, so the Seestar got one, and then a new Astronomy folder with a note for each of the 65 targets. Claude read the file names and FITS headers and filled in each note with:

    • What it is. A short description, its catalogue numbers and common name, and a type: galaxy, emission nebula, planetary nebula, cluster, comet, planet or star.
    • Capture stats. Number of sub-frames, exposure, filter, gain, total integration time, number of nights, first and last dates, the biggest stack and how much space it takes on the NAS.
    • A session table. One row per night, with the frames and integration for that night. Nights run noon to noon, so frames taken after midnight count towards the evening they started.
    • Space for me. Empty fields for a rating, the processed image, where it ends up published, and my own notes.

    Because the stats are in each note’s properties, an Obsidian Base turns the whole folder into a sortable table, which is where the fun numbers come from.

    What it adds up to

    • 65 targets: 20 galaxies, 16 emission nebulae, five planetary nebulae, five planets, seven stars, a few clusters, two comets, the Moon and the Sun (through a solar filter).
    • About 24,600 sub-frames, almost all of them 10-second exposures.
    • About 77 hours of integration across 82 nights, from the first session in March 2025.
    • Nearly half the targets were a one-night stand. 31 of the 65 were only ever captured on a single night.

    The clear favourite is the Whirlpool Galaxy, M 51: 17.4 hours over 21 nights, with the biggest single stack at 1,362 frames (nearly four hours). That one target is almost a quarter of everything I’ve captured. After that it drops off quickly:

    • the Pacman Nebula (NGC 281), about 7.1 hours
    • the Horsehead Nebula region (IC 434), about 6.2 hours
    • Bode’s Galaxy (M 81), about 3.7 hours
    • the Andromeda Galaxy (M 31), about 3.4 hours

    The session dates tell their own story too. April 2025, the first full month, had 16 nights; June and July together have just one. In Scotland it barely gets dark in midsummer, and the catalogue shows it.

    The Andromeda Galaxy as a bright oval core with faint spiral arms, surrounded by stars, taken with a Seestar S50
    The Andromeda Galaxy (M 31): a 13-minute stack straight off the Seestar, from earlier this week.

    What the catalogue doesn’t do yet

    This was a one-off run, so it’s already slightly out of date. The newest session in it is from August, and I’ve been out again this autumn: a comet, 161P/Hartley-IRAS, in October, and Andromeda again this week. Those stacks are on Flickr, but they aren’t in the notes yet.

    It also only counts. It says nothing about whether the frames are any good, and some of them certainly won’t be.

    What comes next

    I’ve written the next steps up as a project in my vault. They are ideas at this stage rather than anything built:

    • Quality scoring. Score every sub-frame for sharpness, background and satellite trails so the bad ones can be thrown out before stacking, and keep the per-target stats up to date as new sessions arrive.
    • Proper stacking on the PC. Siril can be scripted, and can stack many nights of one target together. It would run on the Raspberry Pi, but the Pi is already busy running everything else, so the Windows PC, with a proper graphics card, is the better place for the heavy work.
    • Publishing. Finished images are to go on vividgrey.co.uk. The idea is the same pattern as this blog: Claude creates a draft post per target through the WordPress API, and I review and publish it myself.
    • The extras. A gallery, a Messier and Caldwell observing log, and something that notices new uploads and updates the notes.

    The 17 hours of the Whirlpool Galaxy are the obvious first test. If 21 nights of data stack into something better than the best single night, the rest of the pipeline is worth building.

    If you’ve been following my posts about what I’ve built with Claude Code, this is a slightly different use of it. There’s no service here and nothing running on a timer, just a big pile of data turned into something I can actually browse. Seventy-seven hours under the stars, and I didn’t know until this week.

    This post was drafted by Claude Code from my vault notes on the Seestar and the 65 Astronomy target notes, and written into WordPress as a draft through the API. Claude chose the photo from my Flickr account. I reviewed and edited it before publishing.

  • On This Day: Twenty-Six Years of Photos Back in My Notes

    I’ve been taking photos and putting them on Flickr for a very long time, and like most people I almost never look back at them. Thousands of pictures from holidays, days out and events, all sitting in albums that I last opened the day I uploaded them.

    Meanwhile my Obsidian vault has a note for every trip and a lot of the events I’ve been to, and a Daily note that I open every morning. The two never met. So last weekend I asked Claude Code to connect them, and the result is a small project called FlickrVault. It does two things: it puts an “On This Day” section with old photos into every Daily note, and it links my Flickr albums to the matching Trips and Events notes. (For the wider picture of what runs on my Raspberry Pi, see What I Have Built With Claude Code (So Far).)

    On This Day

    Every night, shortly after the n8n workflow that creates my Daily note has run, a script adds a section headed “On This Day”. For each earlier year in which I took photos on today’s date, it shows:

    • The year and how long ago it was, linked to that day’s photos on Flickr.
    • How many photos I took that day.
    • Up to three thumbnails, spread through the day rather than the first three, so a day that started at breakfast and ended at a show gets a picture from each part. Each thumbnail links to the photo on Flickr.
    • Any Trip or Event note that covers that day, so I can jump straight from “26 years ago” to my notes about where I was.

    It does one Flickr search per year, starting from 1995, which comes to about 30 calls and takes around 45 seconds. Yesterday’s section went all the way back to 2000, 26 years ago. Private photos appear too, which is fine because the vault is private: the thumbnails load without signing in, and the links to Flickr need me to be signed in.

    A few details make it reliable rather than just working on a good day:

    • It never creates the Daily note itself. If n8n hasn’t made it yet, the script logs that it’s waiting and a second run at 06:15 tries again.
    • Re-runs are harmless. If the section is already there, nothing happens. The note is re-read just before writing and replaced in one go, so it can’t trample on something I’ve typed in the meantime.
    • It doesn’t use AI. This is plain Python with no model in the loop. Picking photos by date doesn’t need judgement, so there’s nothing to go wrong and nothing to pay for.

    Flickr’s API isn’t always cooperative. The run log has a fair number of “the Flickr API service is not currently available” errors, but the scheduled runs have filled in every Daily note since it went live on 24 October.

    Linking albums to trips

    The second job runs every Sunday morning and works out which Flickr albums belong to which Trips and Events notes. Each of those notes already has start and end dates, so the rule is simple: an album matches a note when at least 80% of its photos were taken within the note’s dates. What happens next depends on the album’s name:

    • The name fits as well. If the album name shares a word with the note’s name or location, the album’s link goes straight into a flickr_album: list in the note’s properties. The word match is fuzzy, so a misspelt album name like “Maderia” still matches “Madeira”.
    • Only the dates fit. A birthday album taken during a trip, for example, matches on dates but probably isn’t part of the trip. These go into a review note as tasks instead.
    • The name and year fit, but only some of the photos do. If 30–80% of the photos are inside the dates, that also goes to review.

    In the review note I tick a task to link the album, or mark it as cancelled to reject it, and the next Sunday run applies my choice. Rejected pairs are never suggested again, and links that are already in a note are never removed or reordered.

    The first run took a while, because it had to fetch the photo dates for every album (around 800 Flickr calls). Those dates are cached, and only albums that are new or have changed are fetched again, so the weekly run is quick.

    Panorama of a harbour with a row of brightly painted buildings along the waterfront and boats moored in the bay
    Tobermory, from my 2020 trip to Mull. Both of that trip’s albums are now linked from its note.

    What the dry run caught

    Before letting it change any notes, Claude ran the matching as a dry run first. Three problems showed up, all down to the way I’ve named albums over the years:

    • Squashed-together names. Albums named like MNDBall-2015 or Holiday2024-Orkney weren’t being split into words, so they never matched anything by name. The matcher now splits on changes of case and on digits, so those become “mnd ball” and “orkney”. Words like “holiday” and “trip” are ignored, because they’d match everything.
    • parkrun the day before. I have plenty of parkrun albums. Because a match on dates alone allowed a day either side, a Saturday parkrun album was being suggested for a one-day event on the Sunday. Now a match on dates alone has to be strictly inside the note’s dates; the extra day either side is kept only when the name fits too, to allow for photos from the journey and cameras with the wrong clock.
    • Catch-all albums. Favourites, auto-upload and year-only albums were turning up as suggestions. They’re never about one trip or event, so they’re now ignored completely.

    After those fixes, the first real run linked 50 albums to 40 notes (34 trips and 6 events) and put 39 less certain matches in the review note. Some of those are clearly right (an album of a space centre visit during a Florida holiday has a name that shares no words with the trip). I’ll admit that I haven’t worked through them yet: all 39 are still waiting for me.

    Two weathered, abandoned wooden fishing boats lying on a stony shore beside a calm loch, with hills behind
    Old boats at Salen, Mull, 2020.

    Keeping track of which photos are used

    Once photos started appearing in my notes (and, as it happens, in posts on this blog), I wanted to be able to see on Flickr which ones were being used. So every photo that something on the Pi uses gets two tags, claudelinked and one saying what it was used for, and is added to a matching “Linked” album. The On This Day job marks the thumbnails it shows, and the Sunday job finishes by scanning the whole vault for links to my photos, albums and days and marking all of them.

    That scan taught a small lesson about what counts as a failure. On its first big run a handful of Flickr calls failed with gateway timeouts, the run retried them and sent them all, and the run still logged itself as failed, which set off my regression tests. It now counts as failed only if photos are still waiting to be sent when it finishes.

    How it fits with everything else

    • One shared Flickr client. FlickrVault doesn’t talk to Flickr directly. It uses the same small client as everything else on the Pi, which can only read. The one exception is marking used photos, which goes through a separate tool.
    • EventCapture adds photos as it goes. My weekly EventCapture run, which records the shows, meals and days out it finds in my email and calendar, now also checks Flickr for photos from each event and adds an album, or the day’s photos once it has looked at a few to check they’re from the event. The Sunday album job catches anything I upload later.
    • The usual rules. Its own git repo and README, a changelog note in the vault, and a regression test that checks the timers are running, today’s section is there, and the last album run didn’t fail.
    A white lighthouse on a low island under heavy grey clouds tinged with pink at dusk
    A lighthouse at dusk on the last evening of the Mull trip.

    Was it worth it?

    It’s only been running for a week, but yes. Three small photos from a day 16 or 18 years ago, at the top of the note I open every morning, are a far better way back into my photos than albums I never open. The trip links matter more in the long run: my notes about a holiday and the photos from it are finally one click apart.

    Now I just need to work through those 39 suggestions.

    A note on how this post was written: it was drafted by Claude Code from the FlickrVault repo, its code history and my vault notes, and Claude chose the photos from my Flickr account. It wrote the draft directly into WordPress through the WordPress API, and I then reviewed and edited it before publishing.

  • My Home Server Has Found Its Voice

    My Home Server Has Found Its Voice

    Until this week, everything my Raspberry Pi did was silent. It wrote notes, filled in dashboards, sent the odd email and scrolled messages across a little LED panel on my desk, but if I wasn’t looking at a screen I didn’t know about any of it. Now it can talk.

    On 29 October Claude Code and I built two small things: a command-line tool that plays speech or audio on the Google speakers around the house, and a Voice switch on my LED display’s control page that reads out whatever the display is showing. The speech itself is generated on the Pi, not by a cloud service. This post is how it fits together and the few things that tripped us up.

    Why bother?

    I already had the speakers, and I already had a lot of automations producing small bits of useful information: the next train, which bin goes out, what’s flying overhead. Reading them means looking at something. Hearing them doesn’t.

    I started it the way I start most things now: I dropped a task note into my vault’s Inbox asking for a way to play audio on the Google speakers. Before anything was built, I made three choices:

    • Both speech and audio files, not just one or the other.
    • The office speaker as the default, since that’s where I am when I’m working on this stuff.
    • Local text-to-speech rather than the Google Translate voice that Home Assistant already had set up. I’d rather the words my scripts generate weren’t sent off to be turned into audio somewhere else.

    The pieces

    Most of the work turned out to be already done. Home Assistant was running and already knew about every speaker in the house, so the job was mainly joining things up:

    • Home Assistant’s Google Cast integration exposes each speaker, and each speaker group, as a media player that can be told to play something.
    • Piper, an open-source text-to-speech engine, runs in its own Docker container on the Pi. It uses the British English en_GB-alba voice.
    • The Wyoming integration connects Home Assistant to Piper, which gives Home Assistant a new text-to-speech engine to use instead of the cloud one.
    • Home Assistant’s REST API is the single way in. Anything on the Pi that wants to speak makes one API call that says “say this, on that speaker”, and Home Assistant gets Piper to render the audio and tells the speaker where to fetch it.

    The access token for that API lives in a locked-down file on the Pi, like every other secret in this setup, and is read at run time.

    SpeakerCast: one command

    The first piece is SpeakerCast, a bash script of about a hundred lines wrapped around that API. It does three things:

    • speakercast say "…" speaks some text, on the office speaker unless I name another speaker or group.
    • speakercast play plays an audio file or a URL. A local file is copied into a folder Home Assistant serves on my home network, so the speaker can fetch it, and anything in that folder older than a week is tidied away on each run.
    • speakercast list shows every speaker and group Home Assistant knows about.

    There’s an option to set the volume first, and a dry-run option that prints the calls it would make without making a sound. That last one matters more than it sounds: like every service on the Pi, SpeakerCast has a regression test, and a test that runs regularly and says “test” out loud in my office would not last long. The test checks everything short of actually playing anything.

    It was built after midnight, so the only thing we couldn’t check that night was the bit you can hear. I ran the audible test the next morning, a “hello” and a local MP3 on the office speaker, and both played.

    The one gotcha

    Playing a local file needs Home Assistant to serve it over its /local/ web path, which comes from a www folder in its configuration. The catch is that Home Assistant only notices that folder if it exists when Home Assistant starts. Creating it isn’t enough; it needed one restart. Because a restart takes down the things that depend on Home Assistant, Claude waited until after my daily note had been created for the next day before doing it.

    Giving the LED display a voice

    The more fun half came that evening. On my desk there’s a Pi Zero with a Pimoroni Unicorn HAT HD, a 16×16 LED matrix that scrolls messages, with a web control page that’s part of my RailData server. It has a set of quick-send buttons that each fetch something and scroll it across the panel.

    That page now has a Voice Off/On switch. With it on, anything I send to the panel is also spoken on the office speaker:

    • any message I type in
    • the next trains
    • the next bin collection
    • the aircraft overhead (the feed behind it was the subject of last week’s post)
    • the AuroraWatch status
    • command words like “time” and “date”

    The switch starts Off, and the browser remembers it. Automated messages and the background animations stay silent, so the speaker only talks when I’ve asked it to.

    It uses exactly the same route as SpeakerCast: one Home Assistant call with the Piper engine. If the speaker call fails, the error shows on the page, but the message still goes to the panel. The display was there first, so speech is never allowed to break it.

    Writing for the ear, not the eye

    Text written for a 16-pixel-high panel is full of shorthand, and Piper reads exactly what it’s given. So the server rewrites each message before it’s spoken:

    • Command words become sentences. On the panel, “datetime” is drawn by the Pi Zero itself, so the server has to work out what to say, something like “It’s 20:17 on Thursday 29 October.”
    • Shorthand is expanded. The dots that separate items become pauses, arrows become “to”, “ft” and “mi” become feet and miles, “exp” becomes “expected”, and compass points like NE become “north east”.
    • Several messages become one sentence. Trains and bins send more than one message at a time. Speaking each one as a separate call doesn’t work, because the second call cuts the first off mid-sentence, so they’re joined into a single utterance.

    That last one is easy to miss. On a screen, two messages one after the other are fine; out loud, one stamps on the other.

    A pomodoro timer that tells you when to stop

    The display also has a pomodoro timer mode, and later the same evening it got a voice too. With Voice on, I hear “Pomodoro started: 25 minutes” at the start, the time left when I pause or resume, “Pomodoro stopped” if I give up, and at the end “Pomodoro complete. Your 25 minutes are up, time for a break.”

    This one needed a bit more thought, because the timer runs on the Pi Zero, not on the server. If the server tried to work out when 25 minutes were up, it would get it wrong as soon as I paused. So the Pi Zero now publishes an event over MQTT each time the timer changes state, and the server, which was already listening to the display for its live preview, picks up those events and speaks them. The finish is timed by the display itself, so it’s right after a pause, and it’s announced even if I’ve closed the control page.

    We tested it with a one-minute timer: the start and the finish both played on the office speaker.

    What I’ve learned

    • Check what you already have. Home Assistant already knew every speaker in the house. The whole thing was a container, one integration and a hundred lines of bash.
    • Keep the speech local. Piper runs in a small container next to everything else, and the text my scripts generate isn’t sent to a cloud voice service to be turned into audio.
    • Make it opt-in and quiet by default. The switch starts Off, the tests never make a sound, and nothing automated speaks unless I’ve turned it on. A house that talks without being asked would get switched off quickly.
    • Design for the ear. Shorthand, symbols and back-to-back messages all work on a screen and all fail out loud.

    It also gives Claude a new way to reach me: I’ve told it that when an interactive session needs me, it can ask to announce that on the office speaker rather than waiting for me to notice the terminal.

    A note on how this post was written: it was drafted by Claude Code from the SpeakerCast and RailData repos, their code history and the notes in my Obsidian vault, and written into WordPress as a draft through the WordPress API. The header image was generated with Google’s Gemini image model. I then reviewed and edited it before publishing.