The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
Sample 1: the Fo glance screen
Goal. When an agent's recap is a glance line, the round device draws a screen of numbers instead of the recap
card. Say Fo is helping you job hunt and answers GLANCE applied=5 replies=2 interviews=1 goal=10: the device shows
three large numbers with labels, and a ring around the edge filled to 5/10.
You'll build, preview and flash the round device's firmware (devices/harness-device/firmware, ESP32-S3).
The daemon needs no changes: the data reaches the device along the same path the recap already takes.
The counts in the job-hunt example mean:
applied: applications sent so far. A company confirming it received N applications counts all N.replies: times a company or recruiter answered an application. A receipt confirmation is not a reply.interviews: interviews scheduled or proposed.goal: this week's application goal (default 10).
What you'll build — the device with the solution applied (rendered by the firmware's own drawing code, 466 × 466):
| Working (Fo theme) | Recap: the ordinary card | Glance: the same turn as numbers |
|---|---|---|
![]() |
![]() |
![]() |
| the status line in Fo amber instead of green | an answer without a glance line | GLANCE applied=6 replies=0 interviews=1 goal=10 |
preview.sh writes the same three screens (working.png, recap.png, glance.png) on your Mac.
In this folder:
| File | What it's for |
|---|---|
README.md |
this exercise |
preview.sh |
renders Working, Recap and Glance to PNG on the Mac, no device needed |
ppm2png.py |
used by preview.sh to turn the renderer's PPM files into PNG (Python standard library only) |
solution.patch |
the full solution (theme + glance + tests). Apply it to main with git apply |
fo-prompt.md |
what to tell Fo so its answer starts with the glance line |
Install ESP-IDF early (it takes 15-30 minutes and downloads about 2 GB). The preview step doesn't need ESP-IDF; the build step does:
mkdir -p ~/esp && git clone -b v5.5 --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf ~/esp/esp-idf/install.sh esp32s3 . ~/esp/esp-idf/export.sh # run this again in every new terminalThe firmware needs ESP-IDF 5.5 or later (
devices/harness-device/firmware/README.md).
0. The glance line format
GLANCE applied=5 replies=2 interviews=1 goal=10
- Case-sensitive, and at the start of the recap: either the whole recap or its first line.
- After
GLANCEcome at most 4key=valuepairs, separated by spaces.- key:
[a-z]{1,12}. Unknown keys still show as written (pages=12shows the labelpages). - value: an unsigned integer, ≤ 9999.
- key:
goaldoesn't show as a number. It's 100 % of the ring: the ring fills toapplied / goal. If the line has noapplied, the ring counts the first number. With nogoal, there's no ring.- The pairs end at the end of the line, the end of the text, or the first word without an
=. Here's why: the recap the device gets is the opening of the answer, with sentences joined and line breaks turned into spaces (cli/src/lib/deviceRecap.ts,recap_preview()inui_habitat.c). For example,GLANCE applied=5 goal=10 Sent 5 applications today.is still a glance. - A malformed line (5 or more pairs, a key with uppercase letters or
_, a value over 9999 or not a number, twogoals, no number to show) is not a glance: the device draws the normal recap card.
The glance screen has the agent's name on the upper curve (as today), up to 3 large numbers (Inter 44) with labels
below them (Inter 20), a ring around the edge (ht_ring_arc) and the line 5 / 10 applied on the lower curve.
1. Run the preview before you change anything
cd samples/hackathon-fo/01-fo-glance
./preview.sh # about 15 s; writes /tmp/fo-glance-preview/{working,recap,glance}.png and opens them
On main you'll see working.png and recap.png. Glance is reported missing because nothing draws it yet.
preview.sh runs devices/harness-device/firmware/test/test_touch_ui.py with HABITAT_PREVIEW_DIR. That test
compiles the firmware's real UI code for the Mac, steps through the states and writes a PPM for each screen. The
script keeps design-claude-{working,recap,glance}.ppm and converts them to PNG. You need cc (Xcode Command Line
Tools) and python3.
Environment variables: OUT_DIR=... changes the output folder, NO_OPEN=1 skips opening the images,
FIRMWARE_DIR=... renders from a different checkout.
2. Warm-up: a Fo theme (about 30 minutes)
Add a DEVICE_HABITAT_FO build flag, following the existing DEVICE_HABITAT_ORANGE:
devices/harness-device/firmware/main/CMakeLists.txt: findif(DEVICE_HABITAT_ORANGE)and add an identical block forDEVICE_HABITAT_FO(target_compile_definitions(${COMPONENT_LIB} PRIVATE DEVICE_HABITAT_FO=1)).devices/harness-device/firmware/main/ui/habitat/theme.h: under#ifdef DEVICE_HABITAT_FO, set Fo colors for- the
HT_THEME_FOCUS_CANVASbackground (the Focus face; a regular build has only the Focus face, flagHABITAT_FOCUS_ONLY), HT_THEME_ACCENT(the accent color; in the main exercise it fills the glance ring),HT_THEME_VOICE(the mic bar while you speak),- and add
HT_THEME_WORKINGfor the "Coalescing… 0:34" line while the agent works. Its default stays0x00ff2f.
- the
devices/harness-device/firmware/main/ui/habitat/focus.cdoes not read the theme for the green: it has#define FOCUS_VOICE 0x00ff2fu. Replace it withHT_THEME_VOICE, addFOCUS_WORKING=HT_THEME_WORKING, and use it in the three places that draw the working line (search forFOCUS_VOICEinht_focus_face: the line under the scene, the middle line, the lower arc).- To preview the theme: in
test/test_touch_ui.py, next to theHABITAT_TEST_ORANGEline, addif os.environ.get('HABITAT_TEST_FO'): extra_includes.append('-DDEVICE_HABITAT_FO=1')../preview.sh --fosets this variable for you. If anassertcomparing a color with0x00ff2ffails, compare withHT_THEME_WORKINGinstead of the constant.
The colors are only suggestions: the solution uses a 0x081018 background, amber accent 0xffb000, working
0xffc040 and cyan voice 0x00e0ff. The screen is RGB565, so colors are rounded to 5/6/5 bits.
Check: run ./preview.sh --fo; working.png should have a night-blue background and an amber working line.
3. Main exercise: the glance screen
Where the data flows
- Fo answers. The daemon takes the opening of the answer as the recap:
deriveTurnSummary()incli/src/lib/deviceRecap.ts, called fromcli/src/core/agents/cloud.ts(recapOf). cli/src/cable/cableSession.ts,summary(), sends the cable frame{ t: 'summary', agentId, recap, text }over USB.- Firmware:
main/cable_client.c(search forstrcmp(t, "summary")) callsui_project_emit(..., "summary", text, recap). main/ui/habitat/ui_habitat.c:event()stores the whitespace-collapsed recap (recap_preview) inm->preview/a->preview.change()hands it to the agent face:const char *recap = ... a->preview, thenht_character_face(..., recap).main/ui/habitat/focus.c,ht_focus_face(), draws the recap card. This is where you make your change.
What to do
- Parser: create
main/ui/habitat/glance.h, header-only (static inline), so tests only need to include it instead of changing the file lists of dozens of compile commands:typedef struct { char key[13]; uint16_t value; } ht_glance_pair_t; typedef struct { ht_glance_pair_t shown[4]; uint8_t count; bool has_goal; uint16_t goal; } ht_glance_t; bool ht_glance_parse(const char *text, ht_glance_t *g); // true = glance; false = normal recap - Parser tests:
test/test_glance.c, added totest/run.sh(copy the compile block oftest_character, because this test also callsht_focus_face). Cases to cover: a valid line, first line only, text right after the pairs, more than 4 pairs, bad keys (Applied,applied_today, 13 letters), a value over 9999, a missing or wrongGLANCE(glance, not at the start), andgoal(not shown, twogoals, onlygoal). - Drawing: in
ht_focus_face(), right afterbool has_recap = ...:
then writeht_glance_t glance; if (has_recap && ht_glance_parse(recap, &glance)) { resting.showing = false; glance_face(s, f, &glance); return; }static void glance_face(...)above it. The drawing functions are inmain/ui/habitat/terminal.h:ht_arc_title_face(the name on the upper curve),ht_ring_arc(the ring; center, radius and width in 1/16 px, angles counterclockwise from 3 o'clock,width16 = 0is an empty placeholder that holds the slot),ht_lv_label+label_runs(text centered in a column),ht_arc_status_face(the lower curve),ht_measure. Fonts:ht_lv_inter_44,ht_lv_inter_30,ht_lv_inter_20(focus_faces.h). - The most important rule (the comment at the top of
focus.c):ht_damage()compares run i of the old frame with run i of the new frame. If the number or order of runs changes, it redraws the whole 466x466 screen. The home face always emits exactly 11 runs, in the same order. The glance screen also keeps 11 runs in its slots: name · background ring (the pet's slot) · filled ring (the card's slot) · 3 numbers + 1 empty run (the 4 recap lines) · 3 labels (status + 2 resting lines) · lower curve. Where there's nothing to draw, emit an empty run (no_text,ht_ring_arcwithwidth16 = 0). Don't drop runs. - The lower curve makes room for the notification bell and the footer button, like the relaxing face's line: leave it
out when
f->noticesorf->footer_actionis set. - The glance screen has no pet, so it doesn't need to redraw on a timer: in
ht_focus_pet_next_ms(), return0when the recap is a glance. - Preview: in
test/test_touch_ui.py, in theTHE DESIGN EXPORTsection, right afterDESIGN("recap"), add:
After that,DESIGN_HOME(); ui_project_emit("a", "sess", "summary", "GLANCE applied=5 replies=2 interviews=1 goal=10 Sent five applications today.", "GLANCE applied=5 replies=2 interviews=1 goal=10 Sent five applications today."); fake_ms = 1200; scene_take(); DESIGN("glance");./preview.shproducesglance.png.
Layout hints from the solution: ring radius 227, width 8, filled clockwise from 12 o'clock (mid = 90 - half,
half = 180 * applied / goal); numbers at y 187, labels at y 248; 1, 2 or 3 columns 200, 150 or 120 px wide; a number
wider than its column drops to Inter 30.
4. The development loop
cd devices/harness-device/firmware
# 1. Quick look on the Mac (about 15 s), after every UI change
../../../samples/hackathon-fo/01-fo-glance/preview.sh --fo
# 2. Host tests (about 3 minutes) before you flash
bash test/run.sh
# 3. Build for the device (a few minutes the first time, fast after that)
. ~/esp/esp-idf/export.sh
idf.py -B build-fo set-target esp32s3 # first time only
idf.py -B build-fo -DPROJECT_VER=0.0.99 -DDEVICE_HABITAT_FO=1 build
Why 0.0.99: the daemon pushes the official firmware over USB (OTA) to any device running a version older than
the published one. A dev build with a low version gets overwritten after about 15 seconds and your changes
"disappear". 0.0.99 is higher than the published version, so it stays.
Flash (in this order)
Only one process can hold the serial port, and the daemon is holding it:
ls /dev/cu.usbmodem* # find the round device's port
osascript -e 'quit app "Harness"' # 1. quit the Harness app
harness stop # 2. stop the daemon (frees the USB port)
idf.py -B build-fo -p /dev/cu.usbmodemXXXX flash # 3. flash
harness start # 4. start the daemon again
open -a Harness # 5. reopen the app
Don't flash after a failed build. Check: after a while, the device still runs 0.0.99 (Devices in the app, or the
device log). Then send Fo a turn following fo-prompt.md: when the turn ends, the device beeps and shows the glance
screen.
Go back to the official firmware
harness flash # flashes the published firmware again (USB plugged in, app and daemon running as usual)
5. Stuck?
Apply the solution to a clean checkout of main (from the repo root):
git apply --check samples/hackathon-fo/01-fo-glance/solution.patch && git apply samples/hackathon-fo/01-fo-glance/solution.patch
The patch covers theme.h, main/CMakeLists.txt, focus.c (glance_face), the new glance.h, the new
test/test_glance.c, test/run.sh and test/test_touch_ui.py (the glance preview, HABITAT_TEST_FO). To remove the
solution: git apply -R samples/hackathon-fo/01-fo-glance/solution.patch.
Common errors:
preview.shreportsno .../design-claude-glance.ppm: you haven't addedDESIGN("glance")yet (step 3.7).- A test reports
Assertion failed ... count == 11: the glance screen emits too few or too many runs (step 3.4). - The device still shows the recap card: the glance line isn't at the start of Fo's answer (see
fo-prompt.md), or the line is malformed. Try it with the parser intest/test_glance.c. - The device goes back to the old version after you flash: you forgot
-DPROJECT_VER=0.0.99. idf.py flashsays the port is busy: the daemon or the app is still running (harness stop, quit the app).


