# OpenTUI Agent Guide ## Engineering - Reuse existing seams; do not duplicate policy, ownership, or state across TypeScript, Zig, and framework layers. - For bug fixes, first add a focused regression test of observable behavior or invariants. If automation is impossible, record the evidence and remaining manual verification; do not substitute contract sketches or guesses. - Make native ownership explicit; clean up handles, callbacks, buffers, and listeners on every exit path. Bound input-driven work and test lifecycle failures. - Do not interchange byte lengths, code points, graphemes, and terminal display-cell widths. - `oxfmt` is the formatting source of truth (`semi: false`, `printWidth: 120`); avoid unrelated formatting churn. ## Tooling And Runtimes - Use Bun for dependency management and development commands: `bun install`, `bun run