NiroWear

Wear OS 3+ · Round 384-480 px & Square · MIT License

Read full AI answers on your wrist.

NiroWear is a standalone bring-your-own-key chat client adaptive across circular and square Wear OS screens. Connect directly to OpenAI, Gemini, Anthropic, or compatible endpoints with encrypted on-device keys and zero truncation tricks.

Release APK
4.0 MB (v0.3.6)
Protocols
4 SSE adapters
Localization
160 EN / ID keys
Key storage
Keystore AES-GCM
NiroWear rendering prose, heading hierarchy, and blocks inside a 466 pixel watch dial
01 · Watch layout & streaming lab

One circular viewport, tested against hard content

Inspect how ResponseParser turns headings, native LaTeX math, piecewise cases, tables, code blocks, and refusal fallbacks into lazy circular items, compare Room raw Markdown against dial blocks, or run the 16 ms coalesced SSE simulator.

Inspector view (compare dial vs persisted DB text)

Blocks parsed
-
Lazy RenderUnits
-
Contract guard
-
02 · Uncropped 466 x 466 captures

Verified screens from the round display

Five captures come unmodified from signed candidate builds; the active Stop screen was recaptured on Wear OS 5 AVD nirowear-b after centering the Stop label to dx = 0, dy = 0 (see docs/screenshots/provenance.json).

Mixed Markdown answer rendered on the watch face with readable margins

Structured reading instead of chat bubbles

Assistant answers sit flush inside the circular safe margins as semantic blocks. Long explanations scroll smoothly without tiny avatars stealing usable chord width, and raw Markdown stays in Room so future parser updates improve existing chats.

Active stream & Stop

Cancels the active OkHttp call immediately and saves received tokens as STOPPED.

Keyboard & Voice home

Both entry targets meet 48 dp (96 px at 320 dpi). Back-exit drafts persist in Room v3.

24-line code pan

Long fenced code blocks chunk at 24 lines and surface a right-edge pan cue when wider than the watch chord.

Tables as records

Multi-column Markdown tables unwrap into lazy per-row records with repeated headers up to 120 rows.

History & search

Linear conversation history across switched providers, searchable via escaped ASCII LIKE queries.

03 · Six-stage runtime pipeline

From voice or Gboard tap to a 466 px circular dial

Inspect each stage of NiroWear's single-module Kotlin architecture, the exact classes enforcing each boundary, and the verified latency and memory budgets.

04 · Wire protocols & on-device security

Explicit adapters, private LAN pairing, and fail-closed keys

Model names never choose the wire format. Every profile binds explicitly to one of four streaming SSE adapters and validates protocol terminal events before marking a turn complete.

Adapter Streaming Endpoint System Mapping Terminal SSE Event Discovery & Fallback
OpenAI POST {base}/responses Top-level instructions (store: false) response.completed GET /models; manual ID allowed
Compatible POST {base}/chat/completions Leading system message finish_reason: "stop" Optional GET /models; works offline
Gemini POST {base}/models/{m}:streamGenerateContent?alt=sse systemInstruction object finishReason: "STOP" Filtered by generation capability
Anthropic POST {base}/messages Top-level system field message_stop GET /models; 4096 safe fallback

Private-LAN phone pairing walkthrough

Entering a long API key on a watch keyboard is error-prone. Step through the 4-stage ephemeral local Wi-Fi handshake built in PairingServer, PhoneLauncher, and SecretStore, with 1-tap Open on phone, QR/URL setup, and encrypted phone-page model fetching (legacy NFC HCE removed).

Keystore encryption & linear edits

Keys are encrypted inside SecretStore with a non-exportable Android Keystore AES-256-GCM key, version byte 1, 12-byte IV, and credentialRef AAD inside noBackupFilesDir. Transient Keystore IPC errors never destroy sibling profiles' keys, while permanent key invalidation fails closed and prompts re-entry rather than falling back to plaintext.

Editing an earlier user message executes one Room transaction replacing that row and deleting all messages after it, keeping history strictly linear across switched providers.

Manifest: allowBackup="false" · usesCleartextTraffic="false" · FLAG_SECURE
05 · Empirical measurements & boundaries

Verification ledger from Gradle XML and adb logs

Host gates cover the signed v0.3.6 cut; emulator metrics come from Wear OS 5 AVD nirowear-b (466 x 466 px @ 320 dpi, headless SwiftShader); physical Xiaomi Watch 2 hardware runs sit separately.

Check Target Measured result
Release & JVM suite Host & CI (v0.3.6) v0.3.6 tag cut (versionCode 22, 4,181,675 B, SHA-256 1b520644...09849f78, CN=NiroWear Release, assets/dexopt/baseline.prof 8,022 B): 353 JVM tests / 53 suites (352 passed, 1 skipped, 0 failures), ktlintCheck 0 violations, lintDebug 0 errors, 0 source warnings (7 pinned dependency advisories), 0 Kotlin compiler warnings.
CI instrumented & Wear OS 5 AVD AVD 466 / 384 / 360 px (v0.3.6 / v0.3.0) v0.3.6 PR #108 CI instrumented smoke passes 28/28 tests (10 classes) in 5m8s on Wear OS 5 API 34 (466 x 466), plus nirowear-b multi-size Delete-pill QA across 384x384, 466x466, and 360x402. v0.3.0 closeout baseline recorded 11/11 classes (19/19 tests), 0 FATAL upgrade from v0.2.1, cold start median 549 ms, first frame 365.993 ms, warm 37 ms, signed scroll 2.92% jank (377 frames), PSS 30,836 KB.
5,000-msg upgrade & search scale AVD 466 px (probe run) Room v2 schema (9ae11899...) with 200 chats / 5,000 messages migrated to v3 in 286.48 ms; 50 LIKE queries measured 0.53 ms median (4.15 ms P95); 18-swipe History scroll 494 frames / 2.23% jank; 4,485 B torture fixture 460 frames / 6.09% jank on SwiftShader debug; 4 KB mixed stream parse P95 1.080 ms.
Localization, cache & TalkBack order Host & AVD 466 px Exact EN/ID resource string parity in values/strings.xml (160 keys) and values-in/strings.xml + renderer_strings.xml (11 entries; 0 missing/extra); locale-change streamPrefixCache.clear() confined to parseDispatcher; TalkBack traversal Menu -> Reader -> Footer verified (TalkBackTraversalOrderTest); code-block right-edge pan cue verified (CodeBlockPanCueTest).
Xiaomi Watch 2 (v0.3.6 signed + v0.3.2 debug) Watch 2 HW (armeabi-v7a, API 34) Signed v0.3.6 installed in-place over signed v0.3.5 (0 FATAL, versionCode 22, non-DEBUGGABLE, dumpsys nfc clean, Menu verified incl. Text size): cold start median 564 ms (665, 632, 564, 551, 553 ms; WaitTime 577 ms; vs 593 ms on v0.3.5), warm HOT 78 ms (78, 86, 71, 75, 84 ms, WaitTime 82 ms), idle Home PSS 38,493 KB (RSS 120,752 KB, post-Providers 51,852 KB), Providers 18-swipe gfxinfo 494 frames, 2 janky (0.40%, legacy 0 / 0.00%) (P50 5 ms, P90/P95/P99 14 ms; GPU P50 2 ms, P99 10 ms), Thermal Status: 0, battery level 60, temp 325. Prior v0.3.2-prep Watch 2 debug sweep closed #62 & #84 (InputResultUiTest 8/8, CompatibleChatTest 4/4, ReaderNavigationTest 7/7 pre-notice-scroll).

Verified Watch 2 baseline & closed hardware issues

Physical Xiaomi Watch 2 runs closed rotary-absence confirmation (#47), signed v0.3.6 in-place upgrade over v0.3.5 (564 ms cold median, 78 ms warm HOT median, idle Home 38,493 KB PSS, 0.40% scroll jank with 5 ms P50 frame time on Providers), NFC HCE removal, owner live watch verification (#27), phone-browser pairing confirmation (#28), and the v0.3.2 debug instrumentation suite (#62, #84). Pre-upgrade v2 database injection onto the signed container stays intentionally blocked by allowBackup="false" and debuggable=false.

06 · Install & verify

Get NiroWear on your watch

Needs Wear OS 3+ (minSdk 30), 32- or 64-bit ARM, 3.6 MB of storage, and a provider key you own, typed on the watch or sent from a phone on the same Wi-Fi. No account, no relay, no server of ours.

Download app-release.apk from the latest GitHub Release and verify SHA-256 before installing. Builds 0.1.1 through 0.3.6 share CN=NiroWear Release and upgrade in place.

Terminal
adb install -r app-release.apk
sha256sum app-release.apk
# Expected v0.3.6: 1b5206448984bb8d85f45f5ad61bd7637b6eeb6923439b22cfae0b1409849f78
Download v0.3.6 on GitHub Releases

Engineering FAQ

Why is Android cloud backup disabled?

API keys are encrypted under a non-exportable Keystore AES-256-GCM alias bound to that physical device. Restoring ciphertext onto another watch cannot decrypt without the hardware key, so allowBackup="false" stays enforced.

Why store raw Markdown in Room instead of HTML?

Keeping canonical raw Markdown in Room messages lets parser, math, and table-layout improvements apply to historical conversations without migrating saved threads.

Why do Markdown tables unwrap vertically?

Inside a 466 px circle, wide tables squash column headers and truncate digits. Emitting each row as a lazy record with repeated column labels keeps cells readable under vertical scroll.

What happens if an endpoint has no /models route?

Model discovery and credential storage stay separate. Compatible providers accept any manually entered model ID and save offline even when discovery returns 404.