kham.udom work luminora active mirror

Active Mirror

Building an AI-native interactive experience.

Disciplines
UX engineering · Software engineering
Stack
React, TypeScript, Zustand, React Three Fiber, WebSockets, Supabase

Overview and my role

Active Mirror is the app where your Lumie lives: a 3D character you talk to, who keeps your tasks and goals moving. It runs in the browser, installs as a progressive web app, and is used on phones as much as on desktops.

It's a team codebase. I own the surfaces where people first meet the product (startup, sign-in, updates, and the conversation layout), and I built the cross-device data path for player customization end to end. I often start with a functional prototype inside the real app, so interaction ideas are tested against real data and real latency.

Three apps in one browser tab

One tab has to work as a conventional web app, a chat client for a streaming AI service, and a real-time 3D scene rendered on WebGPU with a WebGL 2 fallback. All three compete for the same first load, the same main thread, and the same small screen.

Load, update, and talk only when it helps the user

Startup does only what each moment needs. Signed-out visitors get a sign-in splash and download no 3D assets. Returning visitors see progress from the first paint while the scene preloads underneath, and the 3D runtime loads as its own chunk, kept out of the entry bundle.

Updates wait their turn. I switched the service worker from silent updates to a prompt that appears only after sign-in, so a new release never reloads someone partway through onboarding.

I moved chat onto the AI service's authenticated WebSocket, and in Luminora's companion chat app I hardened the same connection: reconnecting on token refresh with backoff, discarding stale sockets, and restoring the conversation after a drop. Speech bubbles follow the character so text stays readable over a moving scene, and layouts were tuned for touch.

Labels show my involvement: built means I built or own it, contributed means I built parts of it, team means other engineers own it.

  • Desktop browsersame app, same account
  • Phone, installed PWAsame app, same account
  • Active MirrorReact · TypeScript · Zustand · React Three Fibercontributed
  • Startup, sign-in, updatessplash · auth entry · update promptbuilt
  • Customization syncrevisioned saves · lifecycle refreshbuilt
  • Aelora orchestrationpersona, memory, toolsteam
  • Google Geminimodel calls from Aelorateam
  • Supabase Authone session for both pathsteam
  • Edge Functionscustomization save and loadcontributed
  • PostgreSQLrow-level securitycontributed
fig 1. Simplified architecture. The client holds no service secrets; both paths authenticate with the user's session.

Deep dive: customization that follows you across devices

The problem. Players dress and recolor their Lumie, and those choices lived in browser storage. Moving them to the account exposed the harder problem: two devices can edit the same record, a phone left open holds stale state, and a naive save either overwrites newer work or reports a conflict that isn't real.

The approach. Each save carries a revision number, so a device holding older data can't overwrite a newer edit. Local edits are batched and kept in an account-scoped cache until they land. When the app returns to the foreground or reconnects, it reloads the latest look, then retries its own pending edits against that revision.

I chose revisions over last-write-wins because here the latest write is often a stale tab waking up. A revision check turns that case into a reload and retry instead of silent data loss.

Two details mattered. The saved format changed while older clients were still in use, so records upgrade on their next successful save rather than through a bulk migration. And startup had been writing default colors into player records, which created false conflicts. Keeping defaults out of saved data removed them.

Results and verification

The work shipped as a series of small pull requests, each safe to release on its own. The theme-sync change reports 126 passing targeted tests, a clean typecheck and lint, and local PostgreSQL checks of access rules and concurrent saves. Earlier changes tested the server function against both data formats, authentication, stale saves, and the revision race.

Everything is merged. Rollout requires database and server-function deploys ahead of the app, and I haven't verified production deployment, so I don't claim it here.

Buttons, seals, links, and the exploded button anatomy in the hero share one accent ink token. It starts black; raise saturation to blend in the hue. Adjust hue, saturation, radius, or edition and every Charm component (plus each diagram layer) re-themes live. Hover the diagram to expand it.

Reset to defaults

This drawer is a ch-dialog, the radios are ch-radio, and every button, card, and badge on this page is a Charm component. The sliders mutate Charm's token layer on :root. Your changes are saved in this browser.