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.
Harness Pro Codex HD Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: The Codex pet draws from HD frames (AI-upscaled at build time, resampled to display size, dithered) and is never scaled up on the device. Its size, scenes and timings stay the same, and it stays within the device budgets.
Architecture:
- A one-shot script turns the 192 × 208 Codex frames into committed HD PNGs.
- A Pro-owned generator encodes them, plus the overlays drawn at HD scale, into
main/pod/pets_codex.c(pod_codex_pet). - The firmware widens
ht_cell_frame_t.rows, preferspod_codex_petfor "codex", caps Codex's zoom at 8, and drops the smooth path.
Tech Stack: C11 (ESP-IDF 5.5.4; host tests with cc), Python 3 + Pillow, and Real-ESRGAN ncnn (build-time tool only).
Spec: docs/superpowers/specs/2026-10-19-pro-codex-hd-design.md
Paths are relative to devices/harness-pro/firmware/ unless they start with docs/.
Global Constraints
- Claude, Muse and Fo stay byte-identical. Only Codex changes.
- Codex keeps today's scenes, step counts,
step_ms, loops and levels. - Codex on-screen ink box: each side within ±3% of today, on every screen in the spec's table.
- Codex zoom on the Agent room and voice screen is exactly 8. Codex is never drawn above 8.
pets_codex.c.obj≤ 1.35 MB.harness_pro.bin≤ 4.0 MB.- Host perf for the Codex screens (
agent:cli,agent:be,talk:be,talk:be:send) must not exceed the base (6acbd7a05) values. - No new heap or PSRAM allocations.
- No file in this tree, except
.md, may containharness-device(test/test_tree_isolation.py). Paths into the round's tree and to the Real-ESRGAN binary are command-line arguments, never literals. - Real-ESRGAN binary:
scratchpad/esrgan/tool/realesrgan-ncnn-vulkan(v0.2.5.0 macOS, sha256 of the zipe0ad0558…333a). Modelrealesrgan-x4plus-anime,-s 4. - Commit only when the owner asks. Commit steps are offers.
Review Focus
- Listening at mic levels 0–4. The bars, scaled by K, must stay inside the bubble at swing max (test in Task 3).
- The relax plane passes behind the robot. The cut-out uses the HD robot alpha, so no halo is left (gate in Task 1's sheet, assert in Task 3: the overlay has no pixel inside the robot's alpha on depth < 0 steps).
- The small pet below 1× on Recap and Inbox (Tabs cards show the logo). These now come from 224-high frames, and
pod_pet_draw_flat's bake arena (360 K px) must still fit (test in Task 4: render inbox and recap with Codex, no arena overflow; parity holds). - A frame of more than 255 rows.
ink_rows,row_inked,pod_celland extent scans must use the widened field without truncating (test in Task 2). - An
import_pets.shre-run. It would restore Codex intopets.c.pod_pet_formust still pickpod_codex_pet(test in Task 4: lookup order, independent of prune).
Task 1: Size baseline, source frames, HD upscale (owner gate)
Files:
- Create:
test/codex_size_baseline.txttest/codex_size.pyassets/codex/src/{idle,review,waiting,running,listening,waving}/NN.pngscripts/upscale_codex.pyassets/codex/hd/**
- Gitignored mockup:
devices/harness-pro/mockup/pro-codex-quality/hd-sheet.png
Interfaces:
test/codex_size.py [--record]- Builds
pod_renderthe waytest/pod_render.pydoes and renders these screens:agent:cli(ask),agent:be(working), a relax screen for a Codex agent (use the existing screen spec that gives a finished Codex agent, or add apod_renderscreen name if none exists),talk:be,talk:be:send,tabs,recap:<codex agent>,inbox. - For each, it measures the Codex ink box: the bounding box of pixels inside the pet's square whose colour is blue-dominant, b > r + 40.
--recordwritesscreen x0 y0 x1 y1lines totest/codex_size_baseline.txt.- Without
--record, it exits 1 if any side differs by more than 3%.
- Builds
scripts/upscale_codex.py --esrgan BIN [--models DIR] [--src DIR] [--out DIR]- Defaults:
assets/codex/srcandassets/codex/hd. - Scene loops (running, listening, waving, idle): ESRGAN ×4, then premultiplied Lanczos to round(192·K) × round(208·K), with K = 1.6.
- Small-pet loops (idle, review, waiting): ESRGAN ×4, crop to the union alpha box of the 18 frames ×4, then Lanczos to height 224.
- It writes
hd/scene/<loop>/NN.pngandhd/small/<loop>/NN.png, RGBA, straight alpha.
- Defaults:
Step 1: Record the baseline before touching anything. Run
python3 test/codex_size.py --record. Commit-offer the baseline file alone.Step 2: Copy the source frames. Take them from
devices/harness-device/firmware/assets/pets/codex/(pass the path on the command line; do not write it into a file) intoassets/codex/src/. These are 6 loops;listeninghas 4 frames,waving4, the others 6.Step 3: Write and run
scripts/upscale_codex.py. Expected: 20 scene PNGs (running 6, listening 4, waving 4, idle 6) and 18 small PNGs underassets/codex/hd/, withdu -sh assets/codex≤ 6 MB.Step 4: Owner gate. Build
hd-sheet.png(every HD frame beside today's, at device size) and publish it in thepro-codex-qualitypage. Wait for approval before Task 3.
Task 2: ht_cell_frame_t.rows to uint16
Files:
- Modify:
main/pod/pod_types.h:11-12, touint16_t cols, rows; uint8_t cell;- Every narrowing use (
grep -rn "rows" main/pod main/display): casts,uint8_tlocals and loops inpod_draw.candpod_pet.c.
- Test:
test/test_pod_draw.c
Interfaces:
Produces:
ht_cell_frame_t.rowsisuint16_t. Positional initialisers stay{cols,rows,cell,palette,cells,row_at}.Step 1: Write the failing test
test_tall_frame. Build a 4 × 300 packed frame: rows 0 and 299 inked, the rest empty. Draw it withpod_cellat z 8. Check one run at y = 0 and one at y = 299, and thatink_rows(throughpod_pet_ink_hor a direct helper) reports 0..300.Step 2: Run
test/run.sh. Expected: a compile error or a FAIL (300 is truncated to 44).Step 3: Widen the field and fix the uses.
Step 4: Run
test/run.shandtest/golden.sh --check. Expected: both pass, with golden unchanged, which proves no visible change.
Task 3: gen_pro_codex.py → main/pod/pets_codex.c
Files:
- Create:
scripts/gen_pro_codex.py,main/pod/pets_codex.c(generated),test/test_pro_codex.py - Modify:
main/CMakeLists.txt: add"pod/pets_codex.c"besidepets.c.main/pod/pod_pet.h:extern const ht_pet_t pod_codex_pet;test/run.sh: runpython3 "$fw/scripts/gen_pro_codex.py" --checkandpython3 "$here/test_pro_codex.py".
Interfaces:
Consumes:
assets/codex/hd/**(Task 1) androwsuint16 (Task 2).Produces:
const ht_pet_t pod_codex_pet = {"codex",w,h,NULL,pxc_loops,pxc_step_ms,&pxc_work,&pxc_listen,&pxc_send,pxc_frames,NULL,0,&pxc_relax,NULL};wherew,his today's Codexht_pet_tw,h (44,56).- Every other symbol is
static, with the prefixpxc_.
Port, keeping the same behaviour. Port from the round generator
devices/harness-device/firmware/scripts/gen_pets.py@ 6acbd7a05, but do not put that path in the file:CODEX_LOOPS,CODEX_STATE_LOOPS,codex_pet_states(small pet)XWORK_STEPS,XLISTEN_FRAMES,XSEND_STEPS, theX*_MSvalues,generate_pack_scene,listen_bubble, theBAR_*constants,send_overlaygenerate_codex_relax,codex_relax_step,relax_loop_at,relax_plane,XRELAX_MS,XLOOP,XHAND,XROBOT_AT,XTHROW,XCATCHexact_overlay,pack_rows,cell_frames,rgb565,rgb565_panel
Changes from the round generator:
- Robot frames come from
hd/sceneandhd/smallinstead of the 1× PNGs, so drop the 1× resizes. - All 1× coordinates and sizes (canvas
CW, CH, RX, RY, overlay drawing,BAR_*geometry including min and swing,XLOOP,XHAND,XROBOT_AT, plane scale, trail radii) are multiplied by K = 1.6. - Overlays are drawn on a 4K canvas and Lanczos-downsampled by 4.
- Every frame and overlay pixel is composited over
(0x22,0x1F,0x1D), with alpha set to 255 if it is ≥ 24, else 0 (owner gate: soft edge kept). quantise_robotusesdither=Image.Dither.FLOYDSTEINBERG. A pixel is transparent only by alpha; drop the round's "pure black is transparent" rule.exact_overlayquantises like the robot, with ≤ 255 colours, because overlays are now anti-aliased.- Remove the round's
assert w < 256 and h < 256. Keepcols ≤ 480,rows ≤ 65535and packed length < 65536 (pack_rows). dx,dyare 0, because the Pro fits scenes by extent.
- Robot frames come from
--check: exit 1 withmain/pod/pets_codex.c is stale: run scripts/gen_pro_codex.pywhen the output differs.Normal runs print frames and bytes per scene, and the total.
Step 1: Write the failing
test/test_pro_codex.py. It parsesmain/pod/pets_codex.cand asserts:- The scene
stepsandstep_msequal the round's: work 28 × 120, listen 15 × 80 with 5 levels, send 15 × 140, relax 24 × 120. The small-pet step_ms are idle and working 46, done 43, asking 42. - Every
*_pal[N]has N ≤ 256. - The sum of the array element counts is ≤ 1.35 M.
pxc_listen_barsexists. For every x it hasx + w ≤the bubble overlay's width (in scene coordinates).- In relax, for steps 4..18 where the plane is behind the robot, no inked overlay cell lies inside the robot's inked cells. Decode both frames with a small RLE decoder in the test.
- The scene
Step 2: Run it. Expected: FAIL, because the file is missing.
Step 3: Implement and run
python3 scripts/gen_pro_codex.py.Step 4: Run
python3 test/test_pro_codex.py && test/run.sh. Expected: pass.pod_codex_petis compiled but not used yet.
Task 4: Firmware uses the HD Codex
Files:
- Modify:
main/pod/pod_pet.c:15-20:pod_pet_for("codex")returns&pod_codex_pet, whateverht_petsholds.main/pod/pod_pet.c:79,92,378-405: replacesmoothwithhd, which ispet == &pod_codex_pet. For an hd petzmax = 8, andplay_restuses the same cap. Remove thepod_cell_smoothbranch.main/pod/home/ph_talk.c:73: drop the Codex 13 special case.main/pod/home/ph_agent.c:28: fix the comment.main/pod/pod_draw.[ch]: deletepod_cell_smoothifgrepfinds no caller.scripts/prune_pets.py: also drop thecodexrow and everything only it reaches. Then run it onmain/pod/pets.c.test/test_pod_pet.c:341,469-480andtest/test_ph_talk.c:133: update the Codex expectations.README.md"Pets": add the Codex HD pipeline (upscale_codex.py, thengen_pro_codex.py).
- Test:
test/test_pod_pet.candtest/codex_size.py(Task 1).
Interfaces:
Consumes:
pod_codex_pet(Task 3).Step 1: Write the failing C tests.
test_codex_is_hd:pod_pet_for("codex") == &pod_codex_pet.test_codex_room_z8: for each of WORK, LISTEN, SEND, RELAX, REST and ASK, render the room exactly asph_room_petdoes (side 260, zoom8 16). The run of the main frame must be exactlyframe->colswide, and no run may come frompod_cell_smooth.- The same at side 260, zoom8 13 (the voice screen).
Step 2: Run
test/run.sh. Expected: FAIL.Step 3: Implement the changes above.
Step 4: Run the checks:
test/run.shpython3 test/codex_size.py(±3% against the Task 1 baseline)python3 test/test_tree_isolation.py
Expected: all pass. If parity fails on the room scenes, adjust K in
upscale_codex.pyand the generator together and re-run Tasks 1 and 3. K is one constant shared throughassets/codex/hd/K.txt, which the generator reads.
Task 5: Baselines, size, device, owner check
- Step 1: Render for the owner. Render
agent:be,agent:cli,talk:be,talk:be:send, the relax screen,tabs,recap,inboxand the strip fromtest/pod_pet_strip.c. Put them indevices/harness-pro/mockup/pro-codex-quality/firmware.html, publish it, and wait for approval. - Step 2: Host perf. Run
PH_PERF=1 test/test_ph_perf.sh. The Codex screens must be ≤ their base values. Then re-record withPH_PERF_RECORD=1and add a dated comment line. - Step 3: Golden. Run
test/golden.sh, then the Liberation variant, then--check. - Step 4: Size. Run
idf.py -B build-pod -DPROJECT_VER=0.0.99-pod build. Check thatpets_codex.c.obj≤ 1.35 MB andharness_pro.bin≤ 4.0 MB. - Step 5: Device.
- Flash one unit with
FLASH_PORT=<port> bash scripts/flash.sh --build-dir build-pod. - Read
frame_max_uson a Codex room, the waydocs/size-baseline.txtdescribes. It must be ≤ 21,273. - Append the size and frame entry to
devices/harness-pro/docs/size-baseline.txt.
- Flash one unit with
- Step 6: The owner checks the device. Then offer the commit, PR, merge and release per
AGENTS.md.