- Read
CONTEXT.mdbefore structural work. Use its domain language: Browser Surface, Managed Browser Runtime, Shared Browser Page, Presentation, and Host Chrome. - Keep one exact runtime path: Electron offscreen rendering to raw RGBA files to Kitty. Do not add alternate browser backends, old API aliases, or hidden transport modes.
- Keep public orchestration in
src/<domain>.tsand supporting code insrc/<domain>/. Name modules for the policy or resource they own. - Reuse existing seams. Do not duplicate validation, numeric option policy, timers, scheduling, frame-ring policy, or lifecycle state.
- Decode sidecar RPC, HTTP JSON, persisted markers, and other untrusted input once at their entry seam with Effect
Schema. Do not use generic response casts,
isRecord, or object-property probing as validation. - Keep the public runtime Promise-based. Add Effect services or layers only when typed dependency composition or scoped ownership justifies them.
- Keep host composition in
src/<domain>/service.tsand expose curated namespaces fromopentui-browser/effect. BrowserSurface owns scoped renderer attachment; Electron owns scoped Managed Browser Runtime cleanup. Reusesrc/effect/operation.tsfor Promise-to-Effect failure adaptation. - Make ownership and cleanup explicit for processes, profiles, pages, presentations, callbacks, sockets, timers, temporary files, and Kitty images.
- Bound producer-driven work and prefer latest-state reconciliation for frames, pointer moves, wheel input, and presentation updates.
- Do not create broad
utils.tsorhelpers.tsmodules.
- Use Bun for dependency management and scripts.
- Keep this a single-package repository.
- Preserve both Bun and Node runtime paths; do not add Bun-only APIs to shared runtime modules.
- Use
oxfmtas the formatting source of truth. - For observable fixes, add a focused regression test first. Run the narrowest test, then
bun run typecheckandbun test. - Run
bun run checkandbun run test:packedfor release-facing changes. Runbun run test:electronfor live Electron runtime changes.
- Use
$opentui-browser-architecturefrom.opencode/skills/opentui-browser-architecture/SKILL.mdfor changes or reviews insrc/andtests/.