Farm Guardian
A multi-camera system running on OpenClaw β watching the flock, scoring frames with VLMs, curating the best moments through Discord to Instagram and Facebook.
What This Is
A camera system built with OpenClaw and AI tools, watching the flock across a 13.6-acre hobby farm in Hampton, CT. The Mac Mini M4 Pro sits on the desk indoors; the cameras it runs watch Birdcatraz β the outdoor fenced compound where the grown flock lives, coop and turkey pen included. The same machine runs every camera feed, scores frames with vision-language models, archives the best moments, and pushes them to Instagram and Facebook.
One machine. Frame judge, gem curator, bird guardian.
The headline feature isn't predator detection β that was built but is paused. The headline is the image pipeline: cameras watching the birds through the day, a chain of increasingly expensive judges deciding which frames deserve attention, Discord as the human review table, and the best moments reaching the public as gems.
Most of the engineering here has gone into one question β how do you avoid wasting a slow judge on a photo of an empty pen? β and most of the answers came from reading the archive rather than from reasoning about it. A couple of good ideas died that way.
The Pipeline
This is the system that runs every day:
- Cameras see the birds. Frames get pulled on a steady cadence β no video encoding, no ffmpeg, just clean JPEGs. The phone camera watching Birdcatraz grabs a short burst each time rather than a single frame, because two shots seconds apart on the same still scene can differ enormously in sharpness.
- A cheap detector asks whether anything is happening. An object detector runs first, in about sixteen milliseconds. Judging a frame properly costs five seconds, and for a long time roughly a quarter of that work was being spent confirming an empty pen. Now the expensive judge only gets frames with a bird in them.
- The best frame of the burst goes forward. Sharpness is measured inside the bird rather than across the whole picture β a mistake worth admitting, because grass and foliage throw off so much fine detail that a whole-frame reading rates a soft photo higher than a crisp one.
- The judge scores it. A vision-language model running locally rates expression, notable detail, and technical quality. It deliberately does not score how much of the frame the bird fills. That turned out to be the single best predictor of which photos get picked β which is exactly why it belongs in choosing between frames, not in deciding whether a photo is worth showing a human at all.
- Discord is the review table, and the only real filter. Gems land in a private channel. Boss reacts to the keepers β the one human-in-the-loop step. Reacted gems publish to @pawel_and_pawleen on Instagram and the Yorkies App Facebook Page as photos, carousels, stories and reels.
There's a feedback loop in the middle of all this. Good moments arrive in clusters, not evenly β after a keeper, the odds of another within the next minute run about six times normal. So a hit makes the camera speed up for a minute and a half, and a stretch of empty pen makes it slow down. The pen sets the pace.
The pipeline has posted hundreds of gems since it went live. The archive is a growth record: the palm-sized fluffballs it started watching in April are the full-grown birds filling the frame from Birdcatraz today.
The Hardware
Cameras across the property β named for the hardware, never for where they happen to be pointed. The devices stay; the angles change. The list below is the long-running fleet; the live dashboard above shows whichever ones are reporting frames right now.
| Camera | Hardware | Capabilities |
|---|---|---|
| house-yard | Reolink E1 Outdoor Pro | 4K PTZ with spotlight + siren. 11-position patrol, sky-watch lock, HTTP snapshot polling via reolink_aio. The only unit with deterrents. |
| duo2 | Reolink Duo 2 | Dual-lens panoramic β two sensors stitched into one ultra-wide 8:3 frame. RTSP capture. |
| s7-cam | Samsung Galaxy S7 running the IP Webcam app | Portrait 1080Γ1920 β optimized for Instagram stories and reels, and the best sensor in the fleet. Lives in Birdcatraz on a wireless charging pad, which caps it at a couple of hours a day, so the pipeline is tuned to make the most of whatever window it gets. |
| usb-cam | USB webcam on the Mac Mini | AVFoundation local capture, 1920Γ1080, snapshot polling with auto white-balance and autofocus warmup. |
| mba-cam | MacBook Air 2013 built-in FaceTime HD webcam | 720p via ffmpeg + MediaMTX RTSP bridge on the laptop itself. |
| gwtc | Gateway laptop built-in webcam | 720p via ffmpeg + MediaMTX RTSP on Windows; services auto-start via Shawl. |
The Reolink is the only one with deterrents β spotlight to 100% brightness and a siren loud enough to scatter a hawk mid-dive.
How It Watches
The Mac Mini pulls a JPEG from each camera β no video encoding, no ffmpeg processes, no HLS segments. Still images a few seconds apart are plenty to see what's happening, and they sail through the Cloudflare tunnel instead of choking it.
The cadence isn't fixed on the camera that feeds the gem pipeline. It runs fast while there's something to look at and slows to a heartbeat when the pen is empty, so the effort follows the birds instead of the clock.
It doesn't phone home. No cloud. No subscriptions. No data leaves the network. The dashboard, the camera control, the snapshots β everything runs on that one Mac Mini on the desk.
What's running right now:
- Live snapshot feeds from every camera Guardian currently sees, visible here and on the homepage
- The frame pipeline β burst capture, a fast presence check, best-frame selection, then VLM scoring; strong frames get archived as gems
- Automated posting to Instagram and Facebook via the gem pipeline
- Manual PTZ on the Reolink β pan/tilt by approximate degrees, or jump to a named preset in one tap
- Five on-camera presets: yard-center, coop-approach, fence-line, sky-watch, driveway
- Spotlight and siren as on-demand deterrents from the web UI
- Full REST API exposed via Cloudflare tunnel
Paused, on the bench:
- YOLOv8 + GLM-4V automated detection. The plumbing is all in
farm-guardian, but it's not running against live frames right now. The cameras are watching; the farmer is watching the cameras. - Automated patrol and deterrent escalation. Both have been written and rewritten; for now the farmer drives the camera directly.
Under the Hood
The system is distributed across the property. The Mac Mini (Bubba) is the brain: it polls each camera's frame endpoint, runs the VLM scoring, serves the dashboard API, archives curated gems, and pushes everything out through a Cloudflare tunnel. A second machine β Larry, an MSI Dominator near the coop β handles gateway camera services and provides compute close to the birds.
The cameras themselves do their own publishing. The Reolink serves HTTP snapshots from its own firmware. The Samsung S7 runs the IP Webcam app. The USB and laptop cameras are published by small Python services on whichever host they're plugged into. Add a camera to Guardian's config on the Mini, restart, and it shows up on this page within thirty seconds β no website redeploy.
The Cloudflare tunnel is outbound-only. There's no port forwarding, no opening of router firewalls, no static IP. The Mac Mini reaches out to Cloudflare's edge network, and guardian.markbarney.net reaches back through that tunnel.
Snapshot polling β JPEG every second-and-change β replaced an earlier video pipeline. Browsers cap concurrent HTTP connections at six per domain, and four MJPEG streams plus the API polling burned through that budget the moment anyone opened the live page. Snapshots are short-lived requests that work cleanly with HTTP/2 multiplexing.
The website is Next.js 16 on Railway, deployed on every push to main. It pulls live data from the Mac Mini's API; static content lives in MDX files in the repo.
When Things Break
The Mac Mini is the single point of failure. If it reboots β power blip, OS update, kernel panic β the live feeds and the gems pipeline go dark until the processes come back up. The Cloudflare tunnel auto-restarts and so do the per-host camera services, but the central Guardian process itself is currently a manually launched daemon.
Sub-host failures recover or don't, depending on the host. The Gateway laptop has a watchdog service that catches the post-reboot Windows-DirectShow-zombie pattern and restarts the publisher. The S7's IP Webcam app drifts its orientation settings whenever it's killed; another watchdog re-applies them every ten minutes.
When a camera goes down, this page notices. The dashboard above filters to cameras the backend reports as currently producing frames, so a frozen phone or a dead laptop disappears from the grid until it recovers. A camera that the Mac Mini can still see but this page briefly can't reach shows a thin amber "RECONNECTING" strip and holds its last good frame.
Where the Code Lives
Both repos are public on GitHub:
- farm-guardian β the backend. Camera capture, VLM scoring, the gems pipeline, the API this page consumes, and the social-media posters that push to Instagram and Facebook from the Mac Mini.
- farm-2026 β this website. Field notes, the flock roster, the live Guardian dashboard above, and the gem gallery.
Built with OpenClaw and AI tools β Claude, GPT, and others, coordinated through the same platform that runs the farm.
The Story
This started because hawks were taking chickens. In the first week of April 2026, we lost four birds β including Birdgit, a Speckled Sussex who followed you around like a dog. A hawk took her on April 8th.
The response was immediate. Within hours, sky-watch mode was built β locking the PTZ camera onto a fixed overhead position. Alert images were upgraded from blurry 1080p RTSP frames to sharp 4K snapshots. The camera doesn't just patrol anymore β it can hold still and stare at the sky.
Reinforcements arrived the same week: a brooder full of new chicks under heat lamps, next to the Mac Mini that watched over them. Birddor (hatched as Birdadette) β the first bird of the 2026 season β emerged from his egg on the keyboard, two feet from the machine that would become his guardian. Those chicks are grown now, and the cameras follow them: the whole flock lives outdoors in Birdcatraz, and the system watches the compound instead of the brooder.