# AGENTS.md - alkane-toolkit Short standing orders for working in this repo. Read `HANDOFF.md` first on any resume; it names the live threads. Parent project rules live in `../AGENTS.md` (bench discipline, live-fleet-ops). ## Build / run (this machine) - Never build or run inside the synced repo tree (noexec, slow FS). Cargo target is `~/.cache/alkane-tk-target` (set in `~/.cargo/config.toml`, not committed); wx builds go to `~/.cache/wxbuild` / `~/.cache/wx-3.3.3-linux`. - `scripts/build-wx-linux.sh` (once) then `scripts/build-gui-linux.sh` (release). - CI sets `CARGO_TARGET_DIR=target` and removes target, coverage, bench, and release staging after each job, including failed runs. For local builds, run `scripts/clean-old-builds.sh` at the end of each task; keep only the current release binary and the pinned wxWidgets cache. - The GUI is pure-Rust wxWidgets on the vendored, patched `wx-rs` (`thirdparty/wx-rs/wx-rs-0.2.0-patched`). When you change it, record the change with `python3 scripts/wx_rs_patches.py capture NAME "Subject"` and commit both; CI runs `scripts/wx_rs_patches.py check`. - OS differences in Rust go in `alkane_core::platform` (config dir, private files, null device, console-less helper processes), not inline `cfg`s. ## Development / review / visual-feedback loop Every UI change goes through this loop before it is considered done: 1. Edit, then `scripts/ui-selftest.sh` -- builds and runs the app headless in `ALKANE_SELFTEST` mode: it renders the bench-fleet fixtures through the real widgets and compares the table cells + KPIs to the expected hardware output. Non-zero exit = a regression. Also run `cargo test -p alkane-gui --offline` for the transform-layer unit tests. 2. `scripts/ui-screenshot.sh out.png` -- captures the running UI to a PNG on a private Xvfb display (never the real desktop). Defaults to the offline fixtures (`ALKANE_FAKE_SCAN`) so the shot is deterministic; `--live` scans the network. Eyeball the PNG for layout regressions. 3. Only after both pass, wire in real hardware (a live scan) per parent rules. Headless X gotcha: the GTK window only maps under Xvfb with `GDK_BACKEND=x11` set; without it the app runs but never shows a window. The scripts set it. Windows: `scripts/build-gui-windows.sh` cross-builds the `.exe`; `scripts/ui-selftest-windows.sh` runs the same self-test under Wine, and `. scripts/windows-cross-env.sh` lets `cargo test --target x86_64-pc-windows-gnu` run the unit tests under Wine. Bridge (C++) changes must work on both wxGTK and wxMSW, where the table is wx's generic data view; see docs/windows.md. Real-Windows checks use the Win11 VM (docs/windows.md, "Native Windows runner"). ## Offline modes (no hardware needed) - `ALKANE_FAKE_SCAN=1` -- feed `crates/alkane-gui/src/fixtures.rs` (the 9 bench boards' expected output) instead of scanning. Use for demos and screenshots. - `ALKANE_SELFTEST=1` -- run the workflow self-test and exit (see the loop). Keep the fixtures in step with the bench inventory (`HANDOFF.md` section 7). ## Conventions - Keep discovery, protocol parsing, artifact checks, flash safety, and GUI runtime in Rust. Use Python for CI, release, reporting, and host tests only. - Confidence tags (CONFIRMED/DERIVED/EXTERNAL) on doc claims; cite file paths. - Single-line imperative commit summaries. - No emojis in any file (parent-project + global rule).