Matt Starfield, the Senior Electrical Engineer at Solid Product Design, gave this talk to a university engineering class one week after he first presented Closing the Loop at a hardware meetup. This version had three parts: a lecture on how AI agents can do hardware work on a real bench, a live demo on a board he brought from home, and a hands-on tutorial for students who wanted to close the loop on their own boards.

What Hapimatic is

Hapimatic is the software Starfield built to connect command-line coding agents, such as Claude Code and Codex, to the wider world, including the instruments in his lab. It is a meta-harness: a layer above those agents that shares context between sessions, orchestrates fleets of them, and manages what each one can do. Its core is open source, and it runs on a Linux machine, such as a Raspberry Pi, or on Windows with WSL2.

Matt Starfield pointing to the projected slide that asks what Hapimatic is
Hapimatic sits above the coding agents and runs them as one system

Removing the friction

His method is simple: find whatever slows the work down, remove it, and look for the next limit. His friend Brad Flaugher, the author of AI Harmony, introduced him to Claude Code in May 2025 and handed him a Raspberry Pi to run it on. At first Starfield sat at that Pi approving each step. A free phone app called Happy Coder let him leave his desk, but its hosted server kept dropping. HAPI, a fork built around a self-hosted server, fixed that, and his server has not crashed in about eight months. When HAPI's interface became the limit, he forked it into Hapimatic.

Each fix exposed the next problem. Long tasks overflowed the 200K-token context window of the time, so he split the work into stages that each get a fresh session, tracked in GitHub: format the issue, research and plan it, implement it, and test it. As bugs piled up, the system began filing its own bugs back into the same pipeline, and over months the old failures stopped recurring. When one Raspberry Pi topped out at about ten sessions, Hapimatic became a federated mesh, which now spans three cloud machines, two Raspberry Pis, and two laptops.

You build its bench

The last bottleneck was Starfield himself. An agent could flash firmware onto a board, but a blinking LED, a screen update, or a moving servo is invisible to it, so on nights and weekends the work waited for him. He replaced himself with his lab's instruments and a pan-tilt-zoom camera trained on the bench. The camera was the agent's own suggestion; it picked one out, set up the drivers before it arrived, and had it working within about thirty seconds of being plugged in.

The class's host had asked how to train the system to work with lab gear. His answer:

I'm not training any models when I'm doing this.

Instead he builds the agent a bench. Every instrument needs a digital connection; a power supply with no data port gets a smart outlet to switch it and the camera to read its display. The agent needs to know how to drive each instrument, from its manual or its driver's source code. A manifest in Hapimatic lists what is available and where the details live, disclosed a level at a time so it never floods the context window. Hooks, small programs that watch the conversation and inject the right context when a topic comes up, keep the agent on track; he has about 185 of them, many written after a failure. Some are safety rules: before an agent powers a high-power device or moves anything, it uses the camera to check that Starfield is in the lab, and asks for his go-ahead.

Matt Starfield speaking in front of the slide on building the agent's bench
The central idea: give the agent a bench rather than new training

Cases from the bench

He walked through work on real projects. On an energy-harvesting board meant to show a steady maximum power point, the agent found a firmware variable that kept resetting, and after the fix the readings held within about 4% of their average. When the first flash erased the board's logo, which was missing from the repository, the agent recreated it from the camera's recordings and flashed it back.

A cellular wearable for livestock was expected to last about 9 days but lasted about one. The agent wrote test firmware, measured seven operating states with the power profiler, and found the board efficient; a misconfigured fuel gauge was shutting it down early. After the fix the device ran 17 days before the test was stopped, with charge left for about 20.

A client's breadboard wearable had firmware with no power optimization. The agent stretched its runtime from 5 days to 138 days and drew a schematic in KiCad, since none existed.

Matt Starfield pointing to a slide of hardware examples, with camera images of a board under test
Examples from real projects on his bench

A live demo

The demo board was one he designed, an Arduino Nano-style board with a NeoPixel LED, wired to a logic analyzer and a Nordic PPK2 power profiler. Its firmware stepped through colors every half second. Starfield dictated a change on his phone: flash white between every color, white on for one second and the rest for half a second. The agent updated the firmware and flashed the board, and the room watched the new pattern run.

He then asked for a power profile across operating states, including a sleep state, plotted in the chat. A second test was prepared: while a USB cable is plugged in, a chip on the board drives a pin high that the board ties to ground, wasting about 23 mA. In a separate request during his run before the class, the agent cut the board's current during the blink by about 9 mA by letting the processor idle between timer ticks, and the blink kept its timing. The recording shows the measurements that came back as the talk went on.

Matt Starfield introducing the live demo in front of a diagram of the request, the test, the firmware, and the board
The demo: one request, a test written first, new firmware, and a measurement

Lessons learned

When something looks wrong, check it another way before believing it; an agent once treated a dropped SSH link as a dead machine. He summed up the rule he gave the system:

Don't just take the first signal that you get and assume that's facts.

Read the source code rather than documentation, which can lag behind it. Use the camera to see whether a person is in the lab before asking for hands. Make every new instrument start in its safest state, because defaults can leave power on. And run the server on a platform built to stay on, since Windows updates can restart a WSL2 machine.

The tutorial

For the hands-on part, Starfield and Hapimatic prepared a starter repository for the students' own logic analyzers and power profilers, alongside the open-source Hapimatic core. The steps install Hapimatic on Linux or WSL2, sign in with the access token the installer prints, sign in to an AI provider such as Claude or Codex, start a session, and connect the instruments and a board. He suggested letting a coding agent the students already use do the installation. The slides, the links, and a step-by-step tutorial page are on the talk's page.

Questions from the room

Asked what the system costs to run, Starfield put his own use at roughly $2,000 a month, nearly all of it subscriptions and service fees: Claude, a few cloud machines, and a GitHub bill that grows with the pull requests.

Asked how he keeps agents out of rabbit holes, he described thresholds Hapimatic tracks in its own records. After about four failed attempts at the same fix, it stops and messages him by Telegram or email. A limit of 3,000 turns per session went away once long sessions became healthy; one has logged about 160 hours of agent thinking time. He has about 85 skills, built as small primitives that larger skills call, and they grew from one habit:

So anything I have to do more than once, I make a skill.

His advice was to keep going when the agent hits a wall, and to dictate long requests, then have the system repeat back its understanding before it starts.