Jane Street's Bonsai_term and the TUI Renaissance
Jane Street has introduced Bonsai_term, a framework for building reactive terminal user interfaces (TUIs) based on the Bonsai library. This shift toward TUIs is driven by the need for lightweight, keyboard-centric tools that integrate seamlessly with developer workflows and AI agents.
strace-ui: Transforming System Call Tracing
strace-ui is an interactive TUI that transforms the traditionally inscrutable output of strace into an explorable interface. It addresses the common difficulties of filtering syscalls and following subprocesses in standard strace output.
Key features of strace-ui include:
- Interactive Filtering: Users can hide specific syscalls (e.g.,
futex,epoll_wait) on the fly without rerunning the trace. - File Descriptor Tracking: The tool allows users to jump between syscalls referencing the same file descriptor (FD) and filter by FD, with logic to track FD reuse across forks.
- DNS Resolution: It enhances
strace's--decode-fds=allby resolving IP addresses to hostnames, providing immediate context on network activity. - Process Management: Subprocesses and threads are assigned short numeric labels instead of raw PIDs, simplifying the tracking of complex
strace -fcalls. - Integrated Documentation: Pressing 'm' opens the man page for the current syscall.
Bonsai_term: A Reactive Framework for TUIs
Bonsai_term is an adaptation of Bonsai, a purely functional, state-machine-based framework originally developed for web applications (Bonsai_web). While Bonsai_web uses js_of_ocaml to target JavaScript, Bonsai_term allows developers to write native OCaml programs that can leverage all native OCaml libraries and tools.
Core Architecture
Bonsai components are implemented as purely functional state machines. The framework uses incrementalization, meaning values and views are only recomputed when necessary. This architecture allows for the composition of state and incrementality primitives, similar to hooks in React, but with state managed outside the component hierarchy.
The AI Development Loop
Bonsai_term is specifically designed to be "AI-friendly." The synergy between the TUI modality and LLMs is realized through screenshot tests (expect tests). Because the UI is rendered as plain text, an AI agent can run a test, see the text-based "screenshot" of the UI state, and verify its own work via a diff.
As noted by community members, this closes the feedback loop for AI agents because the UI state lives in the agent's native modality (text), whereas a GUI would require a vision model to inspect.
The TUI Renaissance and the "Claude Code Effect"
Jane Street observes a trend where well-made TUIs are winning over full-featured IDEs due to their speed, simplicity, and portability. This trend was accelerated by the arrival of AI agents like Claude Code in early 2025, which operate natively in the terminal.
Why TUIs are Preferred Over GUIs
- Portability: Terminal emulators are ubiquitous and integrated into editors.
- Performance: TUIs avoid the overhead of frameworks like Electron, which some community members cite as a primary driver for the return to terminal-based tools.
- Developer Ergonomics: Keyboard-driven interfaces are optimized for utility over visual flash.
- Native Integration: Unlike Bonsai_web, Bonsai_term apps are regular OCaml programs, avoiding the complexities of browser APIs and JavaScript transpilation.
Ecosystem and Applications
Jane Street has used Bonsai_term to build a variety of internal tools, including:
- proctopus: A tool for managing multi-process applications.
- dissect: A tool for decomposing bloat in executables.
- diagonals: A TUI for exploring logs, managing deployments, and monitoring CI systems.
- AIDE: An internal agentic coding tool that served as both a demo and a catalyst for the development of Bonsai_term's component library.
Community Perspectives
While Jane Street promotes the TUI renaissance, some developers in the community remain skeptical. Some argue that TUIs are a ‘fashion’ or a strict subset of what a GUI can provide, arguing that any TUI functionality can be implemented in a GUI. Others suggest that the impulse to build custom TUIs is decreasing because AI agents can now generate custom, one-off visualizations for specific problems on the fly, potentially reducing the need for permanent, hand-crafted TUI tools.