It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adreno 304 (`FD304`) Glamor + DRI3 + GLX GPU acceleration** over `panel-mipi-dbi` KMSRO, optimized for `< 2 ms` UI wakeup latency and `< 95 MB` idle RAM on 512 MB devices.
-`src/sxmo-dwm/`: patched `dwm` window manager (`240x320` vertical `bstack` layout, 24px Pango status bar, native `ParentRelative` desktop clock and `"Menu"`/`"Names"` softkey bar, C-level `evdev``SW_LID` slider and universal key wake handling, `*` + `#` screenshot chord via `bananarchy-screenshot`, live `.Xresources` reload, and `.so` plugin loader via `dwm_plugin.h`).
-`src/dwm-plugins/`: preloaded C++20 `240x320` DWM plugins linked against `libneoui.so` and shared headers:
-`theme.h`: header forwarding to `../neoui/neoui.h` for unified `.Xresources` / `~/.xthemes/*.xth` parsing, proportional font sizing (`theme.baseFontSize`), automatic shade derivation, and live Xft/Pango theme reloading (`PluginTheme`).
-`sms_plugin.cpp` (`sms.so` / `xsms`): threaded conversation view whose message bodies are drawn line by line and clipped to the bubble by `renderLayoutLines()`, with a per-message scroll offset (`msgScrollPx`) and right-edge scrollbar; `smsTextMetrics()` accounts GSM-7 septets versus UCS-2 UTF-16 units and concatenated part limits. Reads `sms.txt` logs written by the QMI WMS daemon after 8-bit/16-bit concatenated SMS reassembly.
-`scripts/rootfs-prune-packages.txt`: denylist of Wayland-only, Rust-based, and retired packages purged from existing rootfs trees by `bootstrap-rootfs-container.sh` and `rebuild-image.sh`.
-`scripts/prune-rootfs-packages.sh`: two-phase rootfs pruner (`world` before `apk add`, `purge` after) that reads the denylist and pins `install_if` packages with negative `!pkg` world constraints plus `apk fix`; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`.
All cross-compilation scripts run inside rootless Docker (`alpine:3.24``armv7` sysroot) and write to `prebuilt/`; `build-sxmo-x11.sh`, `sync-prebuilt-overlay.sh`, and `rebuild-image.sh` mirror those artifacts into `overlay/rootfs/` (and `build-sxmo-x11.sh` also refreshes `rootfs/` when present):
-`./scripts/build-kernel-audio.sh` — builds `6.12.1-msm8916` Adreno 304 `drm/msm`, QDSP6 audio, torch LED, camera `.ko` modules, device `.dtb` files, and the `zImage` kernel image from `patches/kernel/config-bananarchy-msm8909.armv7` (exported as `overlay/rootfs/boot/vmlinuz`, `config`, `System.map`). The resolved `.config` is written back to the config file so the module build and the shipped kernel never drift. **Never change `CONFIG_PREEMPT*`, `CONFIG_PM_SLEEP`/`CONFIG_SUSPEND`, `CONFIG_SMP`, `CONFIG_MODVERSIONS`, `CONFIG_MODULE_UNLOAD`, `CONFIG_ENERGY_MODEL`, `CONFIG_PERF_EVENTS`, `CONFIG_FUNCTION_GRAPH_TRACER` or `CONFIG_HZ` in that config without also rebuilding every module from the pmaports kernel package**: vermagic, `struct dev_pm_info` / `struct device` / `struct task_struct` layouts, and the `HZ` macro compiled into module inlines must match the untouched package modules. `CONFIG_SCHED_HRTICK` and `CONFIG_CPU_IDLE_GOV_TEO` are ABI-safe but effectively no-ops on this 2-core, 2-idle-state target. See `BATTERY-OPTIMIZATION-ANALYSIS.md` §14 for the full cost/benefit analysis.
-`./scripts/build-bantam.sh` — fetches and cross-compiles the `bantam` AI agent.
-`./scripts/generate-artwork.py` — regenerates wallpapers, splashes, and icons from `artwork/icon-large.png`.
-`./scripts/version.sh [--print | target_rootfs]` — computes the date-based release version (`<year-letter><MM><DD>` with `2026 = a`) and substitutes `@BANANARCHY_VERSION@` in `etc/os-release`, `etc/issue`, and `etc/motd` (invoked automatically during overlay application and image builds).
-`./chroot-shell.sh` — opens an `armv7` container shell to manage packages in `rootfs/` (`pkg-add`, `pkg-del`, `pkg-search`); bootstraps `rootfs/` first if needed.
-`./rebuild-image.sh <device> [--mkinitfs]` — verifies the clone, syncs `prebuilt/` into `overlay/rootfs/`, bootstraps `rootfs/` from scratch when missing, applies the overlay, and produces flashable images in `images/`.
-`./scripts/bootstrap-rootfs.sh [rootfs-dir] [device] [--force|--check]` — creates a complete `armv7` rootfs from `scripts/rootfs-packages.txt` inside rootless Docker; idempotent via `etc/bananarchy/rootfs-bootstrap.done`.
-`./scripts/prune-rootfs-packages.sh <rootfs-dir> world|purge` — removes Wayland-only, Rust-based, and retired packages from a target rootfs inside the build container.
-`./scripts/sync-prebuilt-overlay.sh [--check]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift.
-`./scripts/bootstrap-flash-deps.sh` — installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory for `flash-edl.py`.
-`sudo ./flash-edl.sh [device]` — flashes `lk2nd` and the system image over Qualcomm USB EDL (`05c6:9008`), using the vendored `vendor/edl/` library and auto-installed host dependencies.
- **Indentation**: always use 2-space indentation in C, C++, Python, Yabasic, and shell scripts (tabs only in Makefiles and TSV files).
- **No emojis**: never use emojis in source code, UI strings, logs, or commit messages (use Nerd Font PUA codepoints defined in `neoui.h` / `phone_data.h` / `dmenu.c` for UI icons).
- **Unified theming**: never hardcode UI colors or font sizes in `dwm`, `dmenu`, `st`, or any DWM plugin. Read colors and proportional font sizes from `PluginTheme` (`src/neoui/neoui.h` / `src/dwm-plugins/theme.h`) / `.Xresources` (`theme.*`), and handle `RELOAD_THEME` on the plugin FIFO.
- **Zero-lag plugin model**: phone UI apps must run as preloaded resident daemons (`--preload`) guarded by `/tmp/dwm_plugin_<name>.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_<name>.fifo`, and rendering into an offscreen `Pixmap` (`240x296` at `X=0, Y=24`) copied with `XCopyArea` to prevent flicker.
- **Multiline text rendering**: on the target Pango/Xft stack `pango_xft_render_layout()` only paints the first line of a long multiline layout, so wrapped bodies must be drawn line by line with `pango_xft_render_layout_line()` using a scroll offset and a bounded visible line count (see `sms_plugin.cpp`, `dialer_plugin.cpp`, `modem_plugin.cpp`, and `neoui_draw_text_wrapped()`). Where the widget has a fixed rectangle, clip with `XftDrawSetClipRectangles()` and reset the clip afterwards so the softkey bar still draws; keep measurement and rendering at the same layout width. `scripts/check-rebuild.sh` guards `sms_plugin.cpp`.
- **SMS text accounting**: never treat `std::string::size()` (UTF-8 bytes) as an SMS character count. Use code-point-aware logic such as `smsTextMetrics()`: GSM-7 septets (160 per part, 153 when concatenated) or UCS-2 UTF-16 units (70 per part, 67 when concatenated). SMS log headers are parsed by `parseSmsHeaderLine()`, which strips `[SIM n]` tags; do not write those tags back into `sms.txt`.
- **Documentation**: keep `README.md`, `MANUAL.md`, `SDK.md`, and `CHANGELOG.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`.
- **Artifact sources**: `prebuilt/` is the single source of truth for compiled artifacts and `scripts/rootfs-packages.txt` for the `armv7` package set. Never edit `overlay/rootfs/` copies of binaries by hand; run `./scripts/sync-prebuilt-overlay.sh` after changing `prebuilt/`.
- **Package hygiene**: keep `scripts/rootfs-packages.txt` free of Rust-based top-level packages (use C `sudo`, never `sudo-rs`) and Wayland-purpose packages; `libwpe` and the `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped. `scripts/check-rebuild.sh` enforces this.
- **Power management**: idle blanking is `dwm`'s native evdev timer (`src/sxmo-dwm/dwm.c`) plus `bananarchy-idle-blank.sh`; the timeout lives in `~/.config/sxmo/idle_blank_timeout` (default 300 s, `0` = off), is edited via **Config -> Screen blank** / `bananarchy-idle-timeout.sh`, and is reloaded on `SIGUSR1`. `~/.cache/sxmo/sxmo.noidle` and `SXMO_UNLOCK_IDLE_TIME` still override it. `bananarchy-screen-wake.sh` (called from the ring and notification hooks) wakes the panel for calls/SMS and resets the timer; locking or closing the lid blanks immediately. Runtime power policy: `/etc/bananarchy-power-policy.conf` +
(`AT$QCDRX`) and `DSDS_SECONDARY_MODE=eco` (QMI secondary GW provisioning
session park on `sxmo_wm.sh display off/on`). Never park a SIM with
`--uim-sim-power-off`: it clears PIN verification. Deep standby is `bananarchy-suspend.sh` / `bananarchy-deep-standby.sh` / `sxmo_autosuspend.sh` / `sxmo_suspend.sh`, gated by `/etc/bananarchy-no-deep-standby` (shipped present = disabled) and inert because `CONFIG_SUSPEND` is off. A full custom module tree rebuild is deliberately **not** planned: this firmware has no PSCI `SYSTEM_SUSPEND`, so `CONFIG_SUSPEND` would only give s2idle (`freeze`), not `mem` / DDR self-refresh, for <1 mA of saving (see `BATTERY-OPTIMIZATION-ANALYSIS.md` §14). Never force `sxmo.noidle`/`sxmo.nosuspend` from the session scripts and never reintroduce the infinite `sxmo_not_suspendable` wakelock. `/etc/bananarchy/` is root-only.
- **Image residue**: `rebuild-image.sh` strips `/var/cache/apk`, all `apk.log*` files, and unused gettext locale trees before `mke2fs` and aborts the build if any apk cache/log remains; never add an `apk` call after that guard.
- **No on-device compiler**: `scripts/rootfs-packages.txt` ships no `gcc`/`g++`/`musl-dev`/`make` and no Janet runtime (`janet`, `janet-dev`, `jpm`); cross-compile native code with `scripts/build-*.sh`. On-device development uses the Yabasic FFI SDK (`neoui.yab` / `neonet.yab`), which requires `yabasic`, `libffi`, `libneoui.so`, and `libcurl.so.4` — never remove those. `scripts/check-rebuild.sh` guards both sides.
- **Core tools**: `curl`, `bc`, `ed`, `rlwrap`, `mandoc`, `nano`, `less`, and `frotz` are pinned core tools asserted by `scripts/check-rebuild.sh`. Perl, Lua, optional Tcl extensions, and the `sqlite` CLI are excluded, while `tcl`, `python3`, `bash`, `luajit`, `gawk`, `jq`, `gojq`, and `quickjs` remain as hard runtime dependencies.
- **Local agent config**: `.bantam.cfg` is a local, gitignored credential file. Never read, edit, commit, or unignore it; `scripts/check-rebuild.sh` verifies that its ignore rule stays in place.
- **Sentence case**: always use sentence case in subheadings and list items across all documentation files (`README.md`, `MANUAL.md`, `SDK.md`, `CHANGELOG.md`, `AGENTS.md`).