<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Matt Gorbsky · Workshop</title>
  <subtitle>Notes from the workshop: home automation, computer vision, embedded hardware and operations software, with the decisions behind them.</subtitle>
  <link href="https://www.gorbsky.com/workshop/feed.xml" rel="self" />
  <link href="https://www.gorbsky.com/" />
  <updated>2026-10-15T00:00:00Z</updated>
  <id>https://www.gorbsky.com/</id>
  <author>
    <name>Matt Gorbsky</name>
  </author>
  <entry>
    <title>What this workshop is</title>
    <link href="https://www.gorbsky.com/workshop/what-this-workshop-is/" />
    <updated>2026-10-15T00:00:00Z</updated>
    <id>https://www.gorbsky.com/workshop/what-this-workshop-is/</id>
    <content type="html">&lt;p&gt;I run a neighbourhood taproom on the Colorado front range, Gravity Brewing. I also work in technology during the day, and in the evenings I build things. This is where I write them down.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-640.webp 640w, https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-1280.webp 1280w, https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-1920.webp 1920w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-640.jpeg&quot; alt=&quot;A workbench at night under a warm lamp: a soldering iron trailing smoke, a bare circuit board, coiled cable, a 3D-printed part, a notebook of sketches and a pint of amber beer, with a dartboard on the wall.&quot; title=&quot;Illustration: the workshop, as imagined rather than photographed&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-640.jpeg 640w, https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-1280.jpeg 1280w, https://www.gorbsky.com/workshop/what-this-workshop-is/FskoBy0L7G-1920.jpeg 1920w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;What gets built here&lt;/h2&gt;
&lt;p&gt;The projects are not related to each other, except that I wanted each one to exist.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A voice assistant that replaced every Alexa in the house, built from small ESP32 satellites, Home Assistant and Claude.&lt;/li&gt;
&lt;li&gt;A dart scoring system that watches a board with three cameras and a Raspberry Pi, meant to run unattended in a bar.&lt;/li&gt;
&lt;li&gt;Operations software for a small brewery, built around compliance, margin and allocation instead of production.&lt;/li&gt;
&lt;li&gt;Taproom gadgets: a control deck behind the bar, a cooler alarm, printed tap handles.&lt;/li&gt;
&lt;li&gt;Games, mostly for the design problems inside them.&lt;/li&gt;
&lt;li&gt;Small builds that solved one problem in one evening.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What a post looks like&lt;/h2&gt;
&lt;p&gt;Each post shows a decision, a constraint, what broke and the numbers. If something worked on the first try, it usually isn&#39;t interesting enough to write about. Where I measured something, you get the figure, even when it is not flattering. A system that scored 56 of 60 darts correctly is a 93 percent system, not a finished one, and the post says so.&lt;/p&gt;
&lt;p&gt;I keep a few habits, and they will come up repeatedly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Decision logs.&lt;/strong&gt; When I decide something, I write down why, on the day. Plans drift. The log does not.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One untested thing at a time.&lt;/strong&gt; Especially with hardware. If you change two things and it stops working, you have learned nothing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Config over code.&lt;/strong&gt; If a YAML file can do the job, a program should not.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Written briefs.&lt;/strong&gt; A task starts as a page saying what done looks like. That matters more when someone else is doing the typing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;How it gets built&lt;/h2&gt;
&lt;p&gt;Most of this was built with an AI coding assistant, Claude Code. It does much of the typing. I make the calls: what to build, what to reject, what counts as working, and when to stop. Each post ends with a short &amp;quot;Built with&amp;quot; note saying which was which.&lt;/p&gt;
&lt;h2&gt;Where to start&lt;/h2&gt;
&lt;p&gt;Three posts open the workshop, one from each of the larger series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/replacing-alexa/&quot;&gt;Replacing Alexa with something I own&lt;/a&gt;: why, and how the rebuild went after the first attempt stalled.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/dartvision/&quot;&gt;Three webcams, a Raspberry Pi, and a dartboard that keeps score&lt;/a&gt;: a system that was confidently wrong, repeatedly, until it wasn&#39;t.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/center-of-gravity/&quot;&gt;Production isn&#39;t the center of a taproom brewery&lt;/a&gt;: the argument behind brewery software built around the parts that carry the risk.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The series&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/arlo/&quot;&gt;Arlo&lt;/a&gt;: replacing every Alexa in the house with satellites, a family board and a small server of agents.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/dartvision/&quot;&gt;DartVision&lt;/a&gt;: steel-tip darts scored by three cameras and a Pi.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/cog/&quot;&gt;Center of Gravity&lt;/a&gt;: operations software for a small brewery.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/taproom/&quot;&gt;Taproom tech&lt;/a&gt;: gadgets for a working taproom.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/play/&quot;&gt;Play&lt;/a&gt;: games and the problems inside them.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/small-builds/&quot;&gt;Small builds&lt;/a&gt;: one-evening projects.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gorbsky.com/workshop/projects/workshop/&quot;&gt;The workshop&lt;/a&gt;: plans, logs, briefs and the habits that keep projects finishable.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What I leave out&lt;/h2&gt;
&lt;p&gt;First names only for family. No addresses, no credentials, no network details. Snippets are short excerpts, not whole files. I do not write about my employer. Illustrations are labelled as illustrations; photos are photos.&lt;/p&gt;
&lt;h2&gt;How to follow&lt;/h2&gt;
&lt;p&gt;New posts go up on a schedule, roughly twice a week. The feed is at &lt;a href=&quot;https://www.gorbsky.com/workshop/feed.xml&quot;&gt;/workshop/feed.xml&lt;/a&gt;. There is no newsletter and no comment section. If a post is wrong, I would like to hear about it; the address is on the homepage.&lt;/p&gt;
&lt;h2&gt;Built with&lt;/h2&gt;
&lt;p&gt;This site is Markdown files turned into pages by Eleventy. Posts are written ahead of time and published on their scheduled date, with no one pressing a button on the day. Claude drafted much of it, and I read every post before it goes out.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Replacing Alexa with something I own</title>
    <link href="https://www.gorbsky.com/workshop/replacing-alexa/" />
    <updated>2026-10-15T00:00:00Z</updated>
    <id>https://www.gorbsky.com/workshop/replacing-alexa/</id>
    <content type="html">&lt;p&gt;Our house had nine Echo devices in eight rooms. They ran 14 routines that lived
in Amazon&#39;s cloud, and the only way to see or change what they did was Amazon&#39;s
app.&lt;/p&gt;
&lt;p&gt;I didn&#39;t want the family&#39;s household to depend on that. So the plan was
simple to state and less simple to build: every Echo gets replaced by something
that runs on hardware we own, answers in our own words and can be fixed by
editing a text file. Marisa, Maya, Meghan and I would notice the difference
only if it was worse.&lt;/p&gt;
&lt;p&gt;The first attempt, which I called Arlo, never got that far.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-640.webp 640w, https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-1280.webp 1280w, https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-1920.webp 1920w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-640.jpeg&quot; alt=&quot;A store-bought smart speaker on a kitchen counter beside an open 3D-printed box holding a bare circuit board, with a glowing mountain picture on the hallway wall behind.&quot; title=&quot;Illustration: the old speaker and its replacement, with the family board in the hallway behind&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-640.jpeg 640w, https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-1280.jpeg 1280w, https://www.gorbsky.com/workshop/replacing-alexa/i1KpdDs9un-1920.jpeg 1920w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;The first attempt stalled before anything was flashed&lt;/h2&gt;
&lt;p&gt;Version one was an ESP32-S3 board with a microphone and a speaker, and
firmware I intended to write myself in ESP-IDF, the vendor&#39;s C framework. The
project had a milestone list: M0 board census, M1 Wi-Fi and a clock, M2 HTTPS,
and then the microphone, the speaker, speech-to-text, Claude, text-to-speech.
Only M0 to M2 were ever written. The README says why the rest wasn&#39;t: two
untested things at once means neither of us knows which one is broken.&lt;/p&gt;
&lt;p&gt;The plan was also a 70 KB hand-written HTML file. It described the pins, the
parts and the wiring, and it drifted from the code the moment either one
changed. A plan I couldn&#39;t trust was worse than none.&lt;/p&gt;
&lt;p&gt;When I restarted on 2026-10-02, I wrote down the diagnosis. Version one had
stalled on custom firmware before anything was flashed. The audio problems I
was about to solve by hand, I2S in and out, were already solved in ESPHome.&lt;/p&gt;
&lt;h2&gt;What I built&lt;/h2&gt;
&lt;p&gt;The rebuild has four parts, and I wrote almost none of the code in any of them.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Satellites.&lt;/strong&gt; ESP32-S3 boards with a microphone, an amplifier and a speaker, one per room. They run ESPHome, which turns a YAML file into firmware that does the audio, the wake word and the connection to Home Assistant. The first one was a bench rig built from parts I had on hand. The second uses a four-microphone array with its own noise and echo processing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Home Assistant&lt;/strong&gt; on a Raspberry Pi 5, running its Assist voice pipeline.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Claude&lt;/strong&gt; as the pipeline&#39;s conversation agent, through Home Assistant&#39;s own Anthropic integration (model &lt;code&gt;claude-haiku-4-5&lt;/code&gt;). No custom integration and no server of mine in the path.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Phones.&lt;/strong&gt; Everyone in the family has an Android phone, so the Home Assistant Companion app becomes the default assistant, with the same wake word and remote access.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The wake word is &amp;quot;Hey Jarvis&amp;quot;. I first planned a custom &amp;quot;Hey Arlo&amp;quot;, then
dropped it the same day: the official model is trained on real recordings,
needs no training from me, and the phone app offers it too, so every device
answers to the same words. The assistant is still called Arlo.&lt;/p&gt;
&lt;h2&gt;How it works&lt;/h2&gt;
&lt;p&gt;A spoken request wakes a satellite on the device, so nothing is streamed until
the wake word fires. Audio goes to Home Assistant, which turns it into text and
asks a question first: is this something I can handle myself? Lights, timers,
lists and a growing set of custom sentences are answered locally. Everything
else goes to Claude, which can call tools that Home Assistant exposes.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.gorbsky.com/workshop/replacing-alexa/_Altvq0S2e-1200.svg&quot; alt=&quot;Diagram: phones and ESPHome satellites send speech to Home Assistant&#39;s Assist pipeline, which answers local intents directly or hands the rest to Claude, which calls Home Assistant tools that reach devices and return a spoken reply.&quot; title=&quot;The path of a request. Local answers skip Claude entirely.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1200&quot; height=&quot;650&quot;&gt;&lt;/p&gt;
&lt;p&gt;The difference matters. On the last ten real runs I measured, a locally
answered question took about 0.05 seconds. Claude took between 2.3 and 3.2
seconds, 2.6 on average. So the common questions got custom sentences, which
are plain pattern lists in YAML:&lt;/p&gt;
&lt;pre class=&quot;language-yaml&quot;&gt;&lt;code class=&quot;language-yaml&quot;&gt;&lt;span class=&quot;token key atrule&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; en
&lt;span class=&quot;token key atrule&quot;&gt;intents&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;token key atrule&quot;&gt;ArloTemperatureInside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token key atrule&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token key atrule&quot;&gt;sentences&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;what[&#39;s| is] the temperature (inside|in [the] house|in here)&quot;&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;how (warm|cold|hot) is it (inside|in [the] house|in here)&quot;&lt;/span&gt;
  &lt;span class=&quot;token key atrule&quot;&gt;ArloTemperatureOutside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;token key atrule&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token key atrule&quot;&gt;sentences&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;what[&#39;s| is] the temperature outside&quot;&lt;/span&gt;
          &lt;span class=&quot;token punctuation&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;how (warm|cold|hot) is it outside&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The pipeline itself is configuration too. A small file names the conversation
engine, the speech engines and one setting that does most of the work,
&lt;code&gt;prefer_local_intents: true&lt;/code&gt;. A script in &lt;code&gt;tools/&lt;/code&gt; reads that file and applies
it to Home Assistant, after a backup.&lt;/p&gt;
&lt;p&gt;That is the rule I ended up calling config over code. In Home Assistant I write
ESPHome YAML, scripts, automations and sentences, and code only to apply or
audit configuration. Anything bigger is a separate agent that needs a written
decision before I build it. It sounds like a constraint. It is mostly why the
system is still understandable.&lt;/p&gt;
&lt;p&gt;The documentation follows the same rule. Pin numbers live once, in a
substitutions file next to the firmware, and a build script generates the
pinout tables and wiring diagrams from it. The 70 KB drift problem can&#39;t recur
if nobody types a GPIO number into a document.&lt;/p&gt;
&lt;h2&gt;Replace nothing, except the morning&lt;/h2&gt;
&lt;p&gt;On 2026-10-02 I made a decision that shaped everything after: replicate
nothing from Alexa. The 14 routines aren&#39;t worth re-implementing, and I didn&#39;t
want to audit and rebuild habits made for another product. The one carry-over
is the morning routine: weather, a summary of the day from the family&#39;s
calendars, and the news. The news is the latest NPR Up First episode.&lt;/p&gt;
&lt;p&gt;The Alexa integration in Home Assistant did a few real jobs, though. Door and
window alerts spoke through the Echos, and two wall-dashboard buttons fired
routines. I audited those on 2026-10-02 and moved them on 2026-10-04:
announcements now go through one script, the two buttons are gone, and the
integration is disabled with zero references left.&lt;/p&gt;
&lt;h2&gt;What went wrong&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;A dead supply looked exactly like a firmware fault.&lt;/strong&gt; On the bench rig the
status light was green, the log was clean and there was no sound. I looked at
wiring and settings first. The cause was the board: on this clone, the 5 V
pin stays disconnected from USB until a jumper is bridged, and the port marked
USB doesn&#39;t power it at all. Bridging the jumper fixed it. Now the first
check when a board is silent is measuring the supply.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;quot;Tomorrow&#39;s weather&amp;quot; read out Erie, Pennsylvania.&lt;/strong&gt; Home Assistant&#39;s built-in
tools showed only current conditions, so Claude searched the web, asked for a
city, heard a partial name and answered for the wrong state. Calendar answers
had also misread &amp;quot;tomorrow&amp;quot; because the model was filtering a week of events
itself. All three failures had one cause, and the fix was a rule: facts come
from Home Assistant tools, not from the model or the web. The tool does the
lookup and the arithmetic and returns a short finished answer. Web search is
for the outside world only.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Alexa deletion did not happen.&lt;/strong&gt; The plan was to delete the integration
on or after 2026-10-11. On 2026-10-10 I took it off the plan: it was too
aggressive. The Echos keep working as Amazon devices and Arlo takes over room
by room. Today it is one satellite on a desk, so the honest status is that
software is well ahead of adoption. Adopting it is the slow part, and
deleting the fallback would only rush it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The wake word never got its twenty-attempt count.&lt;/strong&gt; I waived the hit-rate
test on the first satellite because it was &amp;quot;working well enough&amp;quot; in daily use
and the wake word was about to change. The test moved to the pilot, where it
still has a gate of its own.&lt;/p&gt;
&lt;h2&gt;What the house can do now&lt;/h2&gt;
&lt;p&gt;Set timers and add to the shopping list by voice. Ask the date, the inside and
outside temperature, what is on the list. Ask about the calendars; the
household shares one calendar, and Arlo never asks who is asking. Ask it to
lock the front door, but not to unlock it: that was a decision on 2026-10-05.
Reminders are a to-do list plus one delivery automation. Alerts from
automations reach my phone as well as a speaker.&lt;/p&gt;
&lt;h2&gt;What grew around it&lt;/h2&gt;
&lt;p&gt;Once voice was the front door, other things wanted to sit behind it. A family
board now hangs in the hallway, with scenes by time of day and a backdrop
picked from the forecast. A small mini PC runs a handful of agents that read
the mail and file the bills. Each got its own decision, and each will get its
own post.&lt;/p&gt;
&lt;h2&gt;Lessons&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Don&#39;t write what your platform already ships. The audio code I was about to hand-write is something ESPHome already does from a YAML file.&lt;/li&gt;
&lt;li&gt;Keep one source for numbers that appear in more than one place, and generate the rest.&lt;/li&gt;
&lt;li&gt;Change one thing at a time on hardware, and measure the power before you suspect the firmware.&lt;/li&gt;
&lt;li&gt;When a model has to filter, compute or guess, move that step into a tool and let the model only phrase the answer.&lt;/li&gt;
&lt;li&gt;A gradual replacement is a feature. Keeping the fallback running costs nothing and removes pressure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Built with&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Home Assistant OS on a Raspberry Pi 5, ESPHome for the satellites, and Home Assistant&#39;s Anthropic integration for the conversation.&lt;/li&gt;
&lt;li&gt;Claude Code wrote the ESPHome YAML, the automations and the small Node tools that apply them, and kept the decision log and the generated docs current.&lt;/li&gt;
&lt;li&gt;I made the architecture calls: what to drop from Alexa, the wake word, and the rule on locking.&lt;/li&gt;
&lt;li&gt;I flashed the boards and reported what happened. Claude can&#39;t see the hardware, so it asked for serial logs and photos.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Three webcams, a Raspberry Pi, and a dartboard that keeps score</title>
    <link href="https://www.gorbsky.com/workshop/dartvision/" />
    <updated>2026-10-15T00:00:00Z</updated>
    <id>https://www.gorbsky.com/workshop/dartvision/</id>
    <content type="html">&lt;p&gt;Commercial auto-scoring dartboard systems exist, and they&#39;re good. They also
cost more than the board, the cabinet and a year of darts combined. So I built
one: three USB webcams around a dartboard, a Raspberry Pi 5, and a touchscreen
that shows the score the moment a dart lands.&lt;/p&gt;
&lt;p&gt;Mostly the moment it lands, anyway. This post covers how DartVision works, the
bugs that taught me the most, and the numbers as they stand today. The numbers
aren&#39;t where I want them yet.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://www.gorbsky.com/workshop/dartvision/WicL32gh5W-640.webp 640w, https://www.gorbsky.com/workshop/dartvision/WicL32gh5W-1280.webp 1280w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://www.gorbsky.com/workshop/dartvision/WicL32gh5W-640.jpeg&quot; alt=&quot;The rig: a steel-tip board, an LED ring light on white stands, and the Pi tucked behind the 18 segment.&quot; title=&quot;The rig, seen from camera 0. The Pi 5 is the green board at the left edge.&quot; width=&quot;1280&quot; height=&quot;720&quot; srcset=&quot;https://www.gorbsky.com/workshop/dartvision/WicL32gh5W-640.jpeg 640w, https://www.gorbsky.com/workshop/dartvision/WicL32gh5W-1280.jpeg 1280w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;The setup&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Brain:&lt;/strong&gt; a Raspberry Pi 5 running a Python service (Flask and Socket.IO, with OpenCV and NumPy doing the real work). The UI runs in a Chromium kiosk on a touchscreen.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Eyes:&lt;/strong&gt; three 1280×720 USB cameras running MJPG at 30 fps. Each sits about 43 cm from the bull, about 30° above the board, and they&#39;re spaced 120° apart.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Light:&lt;/strong&gt; an LED ring light around the board, with exposure and white balance locked per camera so the image doesn&#39;t drift as the room changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At that distance the board is about 840 pixels across, so one pixel covers
roughly half a millimetre of board. That&#39;s plenty for scoring, &lt;em&gt;if&lt;/em&gt; you know
exactly where every pixel lands on the board. Most of this project turned out
to be about that &amp;quot;if&amp;quot;.&lt;/p&gt;
&lt;h2&gt;How a dart gets scored&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Something changed.&lt;/strong&gt; Each camera runs a small state machine (empty → changing → stable) on frame differences. When a dart lands and the image settles, the camera reports.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Find the dart&#39;s axis.&lt;/strong&gt; Diff the new frame against the one before the dart. Reject shapes that don&#39;t look like a dart, then reject shadows. Fit a line down the dart&#39;s centreline with RANSAC.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Map it onto the board.&lt;/strong&gt; Each camera has a calibration (a homography plus lens distortion) that turns its 2D line into a line on the board&#39;s surface.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Intersect.&lt;/strong&gt; Two or three cameras give two or three lines. Where they cross is where the dart is. Outliers get thrown out, and if only two cameras fired, the third gets asked to take another look.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Score it.&lt;/strong&gt; Convert that board position into segment and ring, then let the game rules handle the rest: cricket, x01, Killer, Shanghai and a few house games.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Nothing in that pipeline is machine learning. Every throw is saved with its
images, so a learned model is an option later, but classic geometry got
surprisingly far.&lt;/p&gt;
&lt;h2&gt;It never worked, and nobody could tell&lt;/h2&gt;
&lt;p&gt;This started in February as a port of
&lt;a href=&quot;https://github.com/vassdoki/opencv-darts&quot;&gt;opencv-darts&lt;/a&gt;, an older two-camera
Scala project, onto the Pi 5. It ran, the UI looked right, and it never scored
a dart.&lt;/p&gt;
&lt;p&gt;When I came back to it in September, the first job was a full assessment. It
found that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the scoring path threw an exception, which a bare &lt;code&gt;except&lt;/code&gt; quietly swallowed;&lt;/li&gt;
&lt;li&gt;the calibration was seven months stale, with the bullseye off by up to 213 pixels, about 117 mm;&lt;/li&gt;
&lt;li&gt;lens distortion had been measured but was never applied;&lt;/li&gt;
&lt;li&gt;three identical cameras had calibrated focal lengths of 613, 1070 and 1013 px;&lt;/li&gt;
&lt;li&gt;the cameras were streaming uncompressed at 10.6 fps with auto-exposure on.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://www.gorbsky.com/workshop/dartvision/2aGbWux2_Y-640.webp 640w, https://www.gorbsky.com/workshop/dartvision/2aGbWux2_Y-1280.webp 1280w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://www.gorbsky.com/workshop/dartvision/2aGbWux2_Y-640.jpeg&quot; alt=&quot;A calibration overlay drawn on camera 0&#39;s view. The projected board floats well above and behind the real one.&quot; title=&quot;The old calibration, drawn over what camera 0 actually sees. Every score would have been computed against the yellow board.&quot; width=&quot;1280&quot; height=&quot;720&quot; srcset=&quot;https://www.gorbsky.com/workshop/dartvision/2aGbWux2_Y-640.jpeg 640w, https://www.gorbsky.com/workshop/dartvision/2aGbWux2_Y-1280.jpeg 1280w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;That picture settled it: rebuild rather than re-tune. The first thrown darts
scored the next day.&lt;/p&gt;
&lt;h2&gt;Calibrate from the board, not a checkerboard&lt;/h2&gt;
&lt;p&gt;The textbook way to calibrate a camera is to wave a printed checkerboard in
front of it. I tried that, and swapped it out for something better suited to
this job: the dartboard &lt;em&gt;is&lt;/em&gt; a calibration target. It has 20 straight wires
radiating from a known centre and six rings at known radii.&lt;/p&gt;
&lt;p&gt;So each camera finds the bull (automatically, or by a tap on the screen),
you tap the 20 to fix orientation, and a least-squares fit pulls a homography
and radial distortion straight from the edges of those wires and rings.
It&#39;s sub-pixel accurate, needs no printed target, and re-runs in seconds.
The median error is now about 0.4 mm.&lt;/p&gt;
&lt;p&gt;Getting there meant handling some fun failure modes. The board is
symmetric, so a fit can happily come out mirrored, or rotated by one
segment (18°). The ring light also added a green cast that fooled the bull
finder until I normalised the colour balance.&lt;/p&gt;
&lt;h2&gt;Bugs that taught me something&lt;/h2&gt;
&lt;h3&gt;Good averages can hide a bad edge&lt;/h3&gt;
&lt;p&gt;After re-mounting the cameras and switching to a thin-wire board, the
calibration checks all passed, with average error around half a millimetre.
Doubles were still being misread. Plotting the &lt;em&gt;signed&lt;/em&gt; error by sector
showed the fit pulling up to 4.25 mm inward at the double ring, and the
double band is only 8 mm wide. The check had looked only at the points the
fit chose to keep, and an unsigned median hid which way the error ran. Now
there&#39;s a per-sector gate: if any sector is off by more than 2 mm, the
calibration fails.&lt;/p&gt;
&lt;h3&gt;The cameras were looking at different moments&lt;/h3&gt;
&lt;p&gt;Some wrong scores came from two cameras each fitting a perfectly good line
to a &lt;em&gt;different dart&lt;/em&gt;. One camera&#39;s frame had been taken a second or so
later, after the next dart had already landed. The fix was to take all
cameras&#39; frames from the same tick and pick each camera&#39;s dart jointly
instead of separately.&lt;/p&gt;
&lt;h3&gt;Pulling the darts is not a throw&lt;/h3&gt;
&lt;p&gt;In the first real play sessions, 36% of turns scored more than three darts.
The extra one was my hand. Pulling darts out of the board looks a lot like
something new arriving. The data showed the &amp;quot;fourth dart&amp;quot; turning up a
median 8 seconds after the third, usually seen by only two cameras. A
three-dart cap per turn raised the share of clean turns to 87%. Now a pull
just ends the turn.&lt;/p&gt;
&lt;h3&gt;Self-healing that couldn&#39;t stop&lt;/h3&gt;
&lt;p&gt;Cameras get bumped, so I added automatic recalibration when the board
appears to have moved. Camera 0 then recalibrated itself four times in eight
minutes, because each successful refit still left the drift reading above
the trigger. Now drift has to be confirmed, the threshold sits above the
fit&#39;s own noise, a camera can self-heal at most once every ten minutes, and
anything worse gets flagged instead of retried forever.&lt;/p&gt;
&lt;h2&gt;Making it fast without changing a single answer&lt;/h2&gt;
&lt;p&gt;On the Pi, the third dart of a turn took 5–7 seconds to appear on screen.
That&#39;s long enough for players to stare at the screen wondering if it
noticed. Profiling pointed at the dart-axis step. Three changes did most of
the work:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;caching image dilation that was being recomputed on every frame;&lt;/li&gt;
&lt;li&gt;working on small crops instead of full 720p frames;&lt;/li&gt;
&lt;li&gt;vectorising the RANSAC loop while keeping the same random draws.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The median time for that step dropped from &lt;strong&gt;1,660 ms to 429 ms&lt;/strong&gt; (3.9×). To
make sure nothing else changed, I fingerprinted the output on 47 real
throws before and after: the results were bit-identical. (Running the three
cameras in parallel only bought 10%, thanks to Python&#39;s GIL, so that change
never shipped.)&lt;/p&gt;
&lt;h2&gt;Where it stands&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measure&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hand-placed test set (60 darts)&lt;/td&gt;
&lt;td&gt;56 / 60 (93%)&lt;/td&gt;
&lt;td&gt;≥ 95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Calibration error, median&lt;/td&gt;
&lt;td&gt;~0.4 mm&lt;/td&gt;
&lt;td&gt;≤ 5 mm p95&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dart-axis step on the Pi&lt;/td&gt;
&lt;td&gt;429 ms median&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Landing to on-screen&lt;/td&gt;
&lt;td&gt;not yet re-measured&lt;/td&gt;
&lt;td&gt;&amp;lt; 2 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;All of those test numbers come from darts placed by hand. Live play is
harder to measure, because a throw only gets a truth label when someone
corrects its score. The live logs also show what&#39;s left to fix. Over 20
games and 331 throws, about two-thirds of scoring runs were phantoms: the
pipeline woke up, looked, and found no new dart. Each one costs time, and
each one is a chance to score something that isn&#39;t there. One more catch:
when only two cameras see a dart, there&#39;s no third opinion to cross-check
them.&lt;/p&gt;
&lt;h2&gt;Built with an AI pair, deliberately&lt;/h2&gt;
&lt;p&gt;Most of September&#39;s roughly 370 commits were written with Claude Code.
Making that work took more process than I expected:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;One task per branch, one brief per task.&lt;/strong&gt; Each piece of work starts as a written brief with acceptance criteria. Parallel agents work in separate git worktrees.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No test needs hardware.&lt;/strong&gt; Everything runs against recorded camera frames, so the full suite (about 2,900 tests) runs on a laptop.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mutation checks.&lt;/strong&gt; For a fix to count, its test has to fail when the fix is reverted.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Real data over intuition.&lt;/strong&gt; Nearly every fix above came from instrumenting live games and reading the logs, rather than from guessing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even the game art and sound effects are AI-generated. That&#39;s a separate
post.&lt;/p&gt;
&lt;h2&gt;What&#39;s next&lt;/h2&gt;
&lt;p&gt;Accuracy first: get the hand-placed set past 95%, then build a live accuracy
metric that doesn&#39;t depend on someone bothering to correct a score. After
that comes a TV output, so the whole room can see the scoreboard.&lt;/p&gt;
&lt;p&gt;The full source is GPLv3 and builds on
&lt;a href=&quot;https://github.com/vassdoki/opencv-darts&quot;&gt;vassdoki/opencv-darts&lt;/a&gt;, whose
history is preserved in the repo.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Production isn&#39;t the center of a taproom brewery</title>
    <link href="https://www.gorbsky.com/workshop/center-of-gravity/" />
    <updated>2026-10-15T00:00:00Z</updated>
    <id>https://www.gorbsky.com/workshop/center-of-gravity/</id>
    <content type="html">&lt;p&gt;Gravity Brewing is a 10-barrel brewery on the Colorado front range, with a
taproom that sells most of what we make and a wholesale business that we want to
grow. The commercial brewery packages I looked at (Ekos, Ollie and their peers)
all start from the same place. They are built around production: recipes,
batches, tanks, inventory, the brew schedule. Everything else hangs off that.&lt;/p&gt;
&lt;p&gt;For us that is backwards. Our head brewer runs the brewhouse well with a
notebook. One or two batches a week is manageable. Ingredients arrive almost
just in time. Nothing about the brewhouse was where we were losing hours or
making mistakes.&lt;/p&gt;
&lt;p&gt;The pain was in the business above the brewhouse. Filing federal and state
excise reports that have to balance. Knowing whether a pint in the taproom or a
case sold wholesale made us more money. Deciding how much of a limited batch to
hold back for the taproom before promising the rest to wholesale accounts.
Writing orders and getting invoices out. That is where the spreadsheets lived.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-640.webp 640w, https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-1280.webp 1280w, https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-1920.webp 1920w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-640.jpeg&quot; alt=&quot;Stacked kegs in a dim brewery, one glowing amber keg circled by an orbit line, fermentation tanks behind and a bar with a ledger and a tablet of charts to the right.&quot; title=&quot;Illustration: the brewhouse is still there, it just isn&#39;t what everything orbits.&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-640.jpeg 640w, https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-1280.jpeg 1280w, https://www.gorbsky.com/workshop/center-of-gravity/_lq4buNUaO-1920.jpeg 1920w&quot; sizes=&quot;(min-width: 48rem) 42rem, 100vw&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;h2&gt;What I built&lt;/h2&gt;
&lt;p&gt;Center of Gravity (COG) is operations software for a taproom-forward brewery.
The name is the thesis. It treats production as a &lt;em&gt;data input&lt;/em&gt;: it captures just
enough about batches, ingredients and packaging to feed four things that
matter more.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Compliance:&lt;/strong&gt; the monthly federal Brewer&#39;s Report of Operations, the federal excise return, and state and local tax filings, drafted from the data and reviewed by our CPA.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Channel margin:&lt;/strong&gt; what a beer really earns in the taproom versus wholesale, using real ingredient cost rather than a guess.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Allocation:&lt;/strong&gt; how a limited supply of each beer is split between the taproom and wholesale, with a traffic light that says when to stop selling outside.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Wholesale orders and invoicing:&lt;/strong&gt; commitments, availability, and the invoice that goes to the account.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is a web app on Postgres and Supabase, built to be multi-tenant from the
start, so a second brewery could use it without sharing a row with ours. My
partner and I are the first users. I am the product manager, architect and
reviewer. Claude Code writes most of the code.&lt;/p&gt;
&lt;h2&gt;How it works&lt;/h2&gt;
&lt;p&gt;The thesis is easy to say and easy to lose. A feature list written the usual
way drifts back toward the brewhouse, because that is what brewery software
looks like. So I wrote the product down first, and made the decisions that
follow from it before there was much of a UI.&lt;/p&gt;
&lt;p&gt;The requirements document ran to a versioned changelog and took about three
days. It lists what COG will not do as carefully as what it will: it is not a
brewery ERP, not a point of sale, not an accounting system, and it does not try
to run the brewhouse floor. Those non-goals did more work than most of the
goals.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.gorbsky.com/workshop/center-of-gravity/hPVMRa19Pf-1200.svg&quot; alt=&quot;A two-panel diagram. Left: production at the centre with everything else orbiting it. Right: compliance, margin, allocation and invoicing at the centre, with production as an input.&quot; title=&quot;Where the centre sits: the usual design versus COG.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1200&quot; height=&quot;640&quot;&gt;&lt;/p&gt;
&lt;p&gt;Then came a run of architecture decision records, one short dated page per
choice, with the reasoning and the tradeoff written next to the decision. There
were 23 of them before most of the interface existed. Three show how the thesis
shaped the data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Money is stored in whole cents.&lt;/strong&gt; Taproom sales arrive from the point of sale
in cents, and wholesale order lines are priced in cents. The margin engine
compares the two channels, so one unit across all revenue keeps the comparison
exact, with no rounding to reconcile between them. Dollars only appear at the
display edge. The record also admits a wrinkle: ingredient costs already used
decimal dollars, and it explains why that was left alone rather than leaving
someone to wonder.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Corrections are new rows, not edits.&lt;/strong&gt; Anything touching compliance, cost or
beer movement is append-only. A finalized filing cannot be edited; a mistake
becomes an amended filing. A purchase logged wrongly is offset, not rewritten.
Beer that leaves a tank is a row in a ledger, and the ledger has four kinds of
movement because the federal report has four lines. Loss and destroyed beer are
physically the same act and different lines on a form, so they are different
kinds. A generic sketch of the pattern:&lt;/p&gt;
&lt;pre class=&quot;language-sql&quot;&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;-- Illustrative sketch, not the real schema.&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;create&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;table&lt;/span&gt; beer_movements &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;
  id          &lt;span class=&quot;token keyword&quot;&gt;bigint&lt;/span&gt; generated always &lt;span class=&quot;token keyword&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;identity&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;primary&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  kind        &lt;span class=&quot;token keyword&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;null&lt;/span&gt;
              &lt;span class=&quot;token keyword&quot;&gt;check&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;kind &lt;span class=&quot;token operator&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;receive&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;transfer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;loss&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;destroyed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  from_vessel uuid&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  to_vessel   uuid&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  volume_out  &lt;span class=&quot;token keyword&quot;&gt;numeric&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  volume_in   &lt;span class=&quot;token keyword&quot;&gt;numeric&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  note        &lt;span class=&quot;token keyword&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
  created_at  timestamptz &lt;span class=&quot;token operator&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;-- No update or delete policy. A wrong entry is offset by a new row.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;QuickBooks owns invoicing.&lt;/strong&gt; COG had already grown a working invoice stack
when I decided it should not own the invoice at all. Two invoice numbers and
two PDFs for one document is a recipe for disagreement, and the accountant
already lives in QuickBooks. So COG pushes each order there and QuickBooks
assigns the number. The decision record also notes something I did not expect:
QuickBooks cannot be limited to invoices only, so the restriction lives in what
COG&#39;s code is able to call, not in the permissions. The guarantee is the absent
code.&lt;/p&gt;
&lt;h2&gt;What went wrong&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Two lines of work, and nobody knew.&lt;/strong&gt; Development forked on one day and ran in
parallel for two weeks. One line added QuickBooks invoicing and was merged and
deployed. The other, a beer ledger with a real date field on every entry form,
sat in commits that were never pushed. Neither side knew about the other. The
merge was clean only because the two touched almost disjoint files, which is luck
and not process. The cost was subtler than a conflict. The ledger work was
treated as done while none of it had ever run in production, so the thing I
thought was unblocked was still blocked. Claude Code is quick enough that
unmerged work piles up quietly. A written rule that every line of work is pushed
and named in the roadmap would have caught it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The wrong day, after five o&#39;clock.&lt;/strong&gt; Every entry form defaulted its date to
today in UTC. After 5pm in Denver that is already tomorrow, so an evening
packaging run landed on the next day. At a month boundary that means the wrong
reporting period, which is exactly the kind of error a compliance tool exists
to prevent. It had been hiding in plain sight because the dates were not shown;
it surfaced when they became something a person reads and trusts. The proper
fix needs a timezone on the brewery&#39;s profile. Meanwhile the sales margin
queries were moved to Denver days, and the date is at least visible and
editable on every form.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A tax edge case, found by audit.&lt;/strong&gt; I ran an end-to-end walk of the business,
from raw materials to a filed return, against live data. It found that an
invoice for a taxable account in a city we have no tax license row for quietly
came out with zero tax. The only signal was a notice on the invoice page. The
code did what it was told. The model was missing a case, and a quiet zero looks
like a correct answer. The same audit showed the margin numbers were exact on
the revenue side and stale on the cost side, because the cost side depended on
production entries nobody had been making. I had cut production to the minimum,
and had to admit that the minimum feeds everything else.&lt;/p&gt;
&lt;h2&gt;Lessons&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Write the non-goals.&lt;/strong&gt; A list of what the product will not do kept it from sliding back into a generic brewery ERP.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decide the data shape before the screens.&lt;/strong&gt; Cents, append-only records and a ledger whose kinds match the federal form were cheap on day one and expensive to retrofit.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Let the other system own what it already owns.&lt;/strong&gt; Handing invoicing to QuickBooks removed a whole category of disagreement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audit coverage, not just bugs.&lt;/strong&gt; A bug list tells you what is broken. A walk through the business tells you what the software cannot see.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A quiet zero is the worst output.&lt;/strong&gt; Make missing cases loud, and treat a plausible-looking number with no input behind it as suspect.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Built with&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Postgres on Supabase, with row-level security for multi-tenancy; a Next.js and TypeScript app.&lt;/li&gt;
&lt;li&gt;Claude Code wrote most of the application code and migrations, working from the requirements document and decision records.&lt;/li&gt;
&lt;li&gt;I wrote the requirements, made the decisions, reviewed every change and ran the audits.&lt;/li&gt;
&lt;li&gt;QuickBooks Online and Square are connected through narrow clients, read-only where possible.&lt;/li&gt;
&lt;li&gt;Our CPA reviews every compliance filing before it goes anywhere.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
</feed>