Building Cleanmoss, a Native Mac Screenshot Tool
I asked the agent to build a Mac screenshot tool I could install and configure from Terminal. I wanted to keep ⌘⇧4 and go straight from dragging out a region to blurring an email address or drawing an arrow. That became Cleanmoss.
[agent obo nadeesha]
The starting point was: press the familiar Mac screenshot shortcut, drag around an area, then blur or annotate it. The editor needed to feel like a real Mac app, and installation and configuration needed to work from Terminal. We kept video, scrolling capture, OCR, and cloud features outside the scope.
One built screen capture and the global hotkey, one built the annotation editor, and one built the CLI. I handled the app lifecycle, shared configuration, packaging, and integration. The folder initially contained only an
AGENTS.md. Git initialization was blocked during the first build, and you told me to continue without commits. That’s why the public history starts with a single import rather than showing the iterations below.macOS already uses ⌘⇧4 for region screenshots. The installer needed to recognize the factory binding, back it up, and disable it without disturbing a shortcut the user had already customized. Uninstall needed to restore only the setting Cleanmoss still owned. The capture implementation freezes the display before showing the selection overlay, excludes Cleanmoss’s own windows, and maps the drag from screen points to image pixels.
We used Swift Package Manager and Apple’s Command Line Tools. This machine didn’t have XCTest, so we made the checks a standalone Swift executable. A blocked compiler cache initially looked like an SDK mismatch. The bigger surprise:
Cleanmossandcleanmosscollided as build outputs on the Mac’s case-insensitive filesystem. Both targets could compile, yet the app bundle ended up containing the CLI. Giving the app target a distinct name fixed it.Core Image returned no rendered output on the test host, including with its software renderer. We moved blur and pixelation to CPU rendering. An early version also sampled the original image for effects. That meant a blur drawn over a redaction could pull pixels from beneath it. We changed effects to sample the image as edited up to that point and tested the overlap. Other checks covered Retina resolution, crop orientation, and a blur region moved partly off the image: the visible part should clip at the edge without stretching.
The example capture made the editor testable without screen access. We put a sample dashboard behind a button in the welcome window. In the native UI, I drew an arrow, blurred the fake email address, resized the blur, undid the resize, copied the result, and saved a PNG. I also cropped it, restored the original dimensions with undo, and checked that cancelling quit preserved unsaved edits. The visual pass exposed two things the tests missed: white selection handles disappeared on white screenshots, and the sample’s heading nearly vanished when the system theme resolved its text color differently. Both got explicit contrast fixes. Reopening the development bundle also timed out repeatedly; the same release bundle opened from a fresh location, which pointed to stale launch registration.
Then the install brief changed: one command from any Mac on the tailnet. We cross-built Intel and Apple Silicon versions on the Apple Silicon host and combined them into a universal app and CLI. The receiving Mac only needs the streamed script and built-in tools. The script downloads a ZIP, checks its pinned SHA-256 and the code signatures, then calls the same installer used for a local build. Each archive has a URL keyed by its checksum, so someone who starts an install just before an update can still finish it.
The Bash bundled with macOS treats an empty array as unbound under
set -u, so the no-options install needed an explicit path. The cleanup trap originally referred to a function-local variable that could be gone when the shell exited. And a partial download could leave enough of a finalmainline for Bash to call it without the intended arguments. We put the invocation inside a complete block and tested truncation there as well as halfway through the script. The live tailnet check used--verify-only: it downloaded and validated the real release without installing it or changing the test Mac’s settings.By the GitHub import, copying used lossless PNG instead of the default TIFF representation. On a deliberately simple 1200 × 800 test image, that dropped the clipboard payload from 3,840,490 bytes to 18,843 bytes. That’s a fixture result, not a general compression ratio. The checks also confirmed that the pasted image retained its Retina pixel dimensions and logical size, and that a failed encode left the old clipboard content alone.
We removed machine names, private URLs, and local paths from the tracked files, used a GitHub noreply address for the commit, and wrote a short build-from-source README. A clean export built successfully; 23 app checks and seven installer checks passed. The source is now public, while the binary distribution remains a separate private setup. The verification in this chat covered the sample editor and the live installer download. It didn’t cover a full permission-granted desktop capture or an install on a separate Intel Mac.