Technical choices · November 2026

Why Fibo dropped Tauri + xterm.js and draws its terminals natively with GPUI + libghostty-vt

Fibo keeps up to 40 coding-agent sessions in one window. The plan was Tauri + React + xterm.js, with alacritty_terminal in the background. A day of measurements showed the WebView using about 3.5x the memory of a native Ghostty under the same load, and alacritty_terminal needing 1.29 GiB for 40 sessions, so Fibo keeps terminal state in libghostty-vt and draws the cells with GPUI directly on the GPU, at the cost of maintaining a GPUI patch set.

What Fibo is: a native workbench for coding agents such as Claude Code and Codex, open source under MIT. Every session is a real terminal inside the window; a background process, fibo serve, owns all of them, so closing the window does not stop a session. Fibo used to be called Mooring, and before that Keepline; the evaluation below happened in the Keepline days. Install: download the DMG or brew install --cask majiayu000/tap/fibo.
2025-12-09 tasker begins a Claude Code monitor 2026-09-26 Keepline v1.1.4 Bun CLI + web dashboard + Tauri menu bar 10-13 73 sessions observed: ~240 MB resident, 5 s scans 10-19, night terminal workbench planned on Tauri + React + xterm.js + alacritty 10-20, 1 a.m. WebView control run ~3.5x the memory 10-20, daytime VT libraries, 3 prototypes esctest, idle patch 10-20, 16:23 GPUI + libghostty-vt 11-02 moves to this repo; on 11-28 still on the same GPUI
Timeline, not to scale. The terminal workbench was decided on the night of October 19; the rendering stack was measured and settled the next day. Times are UTC+8; sources at the end.

01 The target: 40 sessions, 4 panes, no heavier than 1.2x Ghostty

Fibo is for people who keep 10 to 40 Claude Code and Codex sessions open at once. The shape of the product was settled on the night of October 19: an app made for running and managing agents, where every session is a real terminal and the native CLI runs in the app's own PTY. The requirement, as it was put then, was "a high-performance terminal-type product".

"High performance" first had to become something measurable. The work view is spaces, tabs, and 2 to 4 panes per tab, so the load became 40 sessions with 4 panes visible in one tab and the other 36 parsed in the background without being drawn. The budget is relative: on the same machine under the same load, the total must stay within 1.2x of Ghostty. Two absolute rules sit next to it: nothing renders while the window is hidden, and nothing polls while idle.

The unit of measure cost us once. The first estimate used RSS from ps, which put a long-running Ghostty at 121 MB; phys_footprint, which counts GPU memory and compressed memory, put the same process at 800 MB. RSS misses exactly the parts a graphical program spends, so every number from then on is phys_footprint, with WebKit, XPC and GPU helper processes added to the measured set, and CPU is cumulative CPU time divided by wall-clock time.

ItemDefinition in the evaluation
Load40 sessions, 4 panes visible (2x2), 120x40 cells per pane; 1440x900 pt window, Menlo 12 pt
MemorySum of phys_footprint over the measured process set, sampled every 5 s, median and peak
CPUCumulative CPU time of the set divided by wall-clock time; 100% is one core
BudgetAt most 1.2x Ghostty on the same machine and load; when both sides use under 0.5% CPU it counts as noise
Repeats5 runs per cell in shuffled order, median reported; single first runs only set direction
WorkloadSynthetic output plus a real Codex recording: 250 s, 1.5 MB, 4223 synchronized-output frames with heavy cursor addressing and Chinese text

02 The original plan: Tauri + React + xterm.js

The previous generation of Keepline was a Bun CLI, a web dashboard and a Tauri menu-bar app, released up to v1.1.4. The terminal-workbench spec written on October 19 continued that stack. Its two key decisions:

The spec itself called D03 "the highest-risk point of the plan": the background would have to re-encode alacritty's state as VT sequences xterm.js can consume, with snapshots covering both screens, scroll regions, graphemes, the cursor and every input mode, and there was no serialization API to start from.

The background had its own problem. Keepline's Bun service held about 240 MB of data while watching only 73 sessions, and rescanned every 5 seconds; the Bun runtime itself was about 22 MB, so the weight came from keeping the data in memory and polling. That holds whatever draws the window, so it was settled first: everything resident moves into one Rust background process, transcripts are read incrementally from an offset and driven by events, and Bun no longer stays running.

Original plan (10-19 spec) WebView: React UI one xterm.js per visible pane (a mirror) WebKit web process + GPU process Tauri Rust bridge (Channel) keeplined PTY alacritty_terminal state → VT bytes Bun service transcripts, hooks SQLite rescans every 5 s Chosen (10-20) GPUI window (Rust) UI, tabs, splits, overview cards libghostty-vt for the ≤ 4 visible panes only cells drawn directly on the GPU Unix socket: snapshot first, then bytes fibo serve (one Rust process) PTYs, libghostty-vt for all 40 sessions incremental transcripts, hooks, SQLite, no polling
D03 on the left keeps two VT implementations in sync. On the right both ends run the same engine, and the client parses again only for the panes you can see.

03 The WebView control: ~3.5x the memory, mostly in the GPU process

To find the floor of the WebView route, we first wrote a minimal macOS test program: xterm.js 6 inside the system WKWebView, fed the same output (mixed Chinese and English, colored) as a freshly started Ghostty with its own config, both measured with phys_footprint.

ScenarioMemory (phys_footprint)CPU
Ghostty, 1 window, 400 KiB/s289 MiB14%
WebView + xterm.js (WebGL), 1 pane, 400 KiB/s1029 MiB, 3.56x15%
WebView + xterm.js (WebGL), 4 panes at 100 KiB/s each742 MiB, of which the WebKit GPU process 466 MiB23%
WebView + xterm.js (DOM renderer), 4 panes at 100 KiB/s452 MiB128%, dropped frames
WebView window minimized, 4 panes at 100 KiB/snot recorded0.3%

CPU was about even; memory was not, and the growth was in WebKit's GPU process. That comes from WebKit's process model, not from xterm.js, so one WebView per pane and several WebGL contexts in one WebView both hit it. The DOM renderer saves memory and spends 128% CPU instead. Minimized, CPU fell to 0.3%, so WebKit throttles content you cannot see; that went onto every candidate's correctness list, since a native route has to stop drawing when hidden too.

These were single runs, not five. The evaluation notes why that was enough: a 3.5x gap dwarfs any plausible measurement noise, and a 1.2x memory budget cannot be met from there, so more runs could not change the answer. The WebView route was rejected at this step, and D01 and D03 with it.

04 Terminal state in the background: three VT libraries

The background has to hold the screen and scrollback of 40 sessions and hand the current screen over in full whenever a window reconnects. The evaluation did not pick a whole terminal; it split the stack into 10 layers (PTY, VT parsing and state, Unicode, fonts, GPU rendering, IME and keyboard, scrollback, the session-sharing protocol, the UI framework, ready-made terminal widgets) and recorded 99 entries: 69 candidates and 30 references. Three VT libraries reached measurement: libghostty-vt (through the libghostty-rs bindings), the original plan's alacritty_terminal 0.26.0, and rio-vt 0.5.28.

WINDOW PROCESS · 1 PANE · 400 KiB/s OUTPUT WebView + xterm.js 1029 MiB Ghostty (reference) 289 MiB BACKGROUND · 40 SESSIONS × 10,000 LINES (120 COLUMNS, REAL TEXT) alacritty_terminal 1.29 GiB rio-vt 427 MiB libghostty-vt 405 MiB libghostty-vt, compressed 66.5 MiB rejected reference / fallback chosen
One scale for all bars. The top two are single runs; the bottom four are 5 runs each with 0% spread. Compression is libghostty-vt's LZ4 idle compression, about 0.05 s for all 40 sessions.
Metric (median of 5)libghostty-vtalacritty_terminalrio-vt
Empty session, each0.025 MiB0.27 MiB0.11 MiB
10,000 lines of history, per session9.8 MiB32 MiB10.3 MiB
40 sessions, whole process405 MiB1.29 GiB427 MiB
After idle compression66.5 MiBnonenone
Snapshot (10,000 lines)full: 6.8 MB, encode 2.3 ms, restore 5.0 ms, first screen drawable after 0.09 msnot supportedvisible screen only, drops combining marks
esctest2 passes (of 567)147101101
Parsing the real Codex recording4.3 ns/byte4.584.61

A few details:

The decision record lists libghostty-vt's costs too: upstream has no releases and the snapshot API lives only on main, so it is pinned to a commit; the bindings are maintained by one person; the build pulls in the Zig 0.16 toolchain, and Cargo's debug profile builds the Zig part in Debug unless LIBGHOSTTY_VT_SYS_OPTIMIZE=ReleaseFast is set; it statically includes simdutf, so it cannot be linked into one binary with rio-vt, which does the same; and mode 2027 has to be turned on for grapheme widths to match Ghostty.app.

05 The window: three prototypes against Ghostty

With libghostty-vt chosen for the background, the window was next. A minimal session-sharing prototype, kl-relay, sat between them (40 idle sessions: 35 MiB, 0.13% CPU), and three client prototypes connected to it:

The first batch of 3 runs was thrown out. macOS does not promise to bring a GUI program launched from the command line without an app bundle to the front; once its window is covered, GPUI and GhosttyKit both stop rendering, and the same scenario split into two clusters, for example P2 idle at 284 MiB once and 58 MiB another time. From then on the test windows used a floating window level, and any run with load but zero frames, or under 1% CPU, was marked invalid automatically. The 5 valid runs:

Client1 pane, real Codex: memory / CPUIdle: memory / CPU4 panes, real Codex4 panes, synthetic 100 KiB/s
Ghostty.app (reference)316 MiB / 9.8%76 MiB / 0.10%not measurednot measured
P1 GPUI + alacritty287 MiB / 5.4%42 MiB / 0.80%327 MiB / 11.2%448 MiB / 20.6%
P2 Swift + GhosttyKit296 MiB / 3.4%58 MiB / 0.07%377 MiB / 8.3%536 MiB / 39.3%
P3 GPUI + libghostty-vt288 MiB / 5.9%42 MiB / 0.86%328 MiB / 13.2%374 MiB / 23.7%

With one pane of real Codex output all three prototypes were within budget: GPUI used 0.91x Ghostty.app's memory and 0.55 to 0.60x its CPU, with p95 frame times of 1.6 to 1.9 ms and no frame over 16.7 ms. P1 and P3 were nearly identical, so the client's VT engine did not separate them; the framework did. With output, GPUI grew from 42 MiB idle to 287 MiB and Ghostty.app from 76 to 316, probably Metal frame buffers and glyph atlases, which were not broken down at the time.

The idle column is where GPUI missed: a GPUI window drawing nothing still used 0.8% CPU.

06 The surprise: idle GPUI used 8x Ghostty's CPU

0.80% against 0.10% is 8x Ghostty.app, above the 0.5% noise line. Reading the source and a sample profile showed why. In GPUI's macOS backend, while a window is visible a CVDisplayLink wakes it on every screen refresh to check invalidator.is_dirty(), whether or not anything needs drawing, and it only stops when the window is covered. Four panes in one window share a single display link, but that link never sleeps.

The fix was a GPUI patch: after a number of vsyncs with no new draw request, stop the display link; the moment the window is marked dirty, start it again so the next vsync draws. The core of the patch, simplified (locking and field setup removed):

// at the end of every vsync callback
if pause_idle {
    if frame_demand {
        idle_frames = 0;
    } else {
        idle_frames += 1;
        if idle_frames >= idle_frames_limit {
            stop_display_link();
            paused_for_idle = true;
        }
    }
}

// when the window is marked dirty (the new frame_waker)
frame_demand = true;
idle_frames = 0;
if paused_for_idle {
    paused_for_idle = false;
    start_display_link();
}

The threshold matters. The first version paused after 3 frames: idle CPU dropped, and 4 panes of bursty output got worse.

Scenario (P3, median of 5)UnpatchedPatched, 3-frame threshold + 60 fps cap
Idle CPU0.86%0.07% (0.70x Ghostty.app)
1 pane, real Codex, CPU5.9%7.4%
4 panes, real Codex, CPU13.2%17.1%
4 panes, real Codex, frame rate34 fps48 fps

Agent output arrives in bursts. The display link kept stopping and restarting, and each restart drew a frame right away, splitting redraws that vsync used to merge into several frames. The 60 fps cap did nothing because the rate never reached 60. The direction worked; the threshold needed to be longer. It became the environment variable GPUI_PAUSE_IDLE_FRAMES, defaulting to 60 frames, about 0.5 s on a 120 Hz display. The 0.5 s setting had not been measured when the decision was made.

Comparing terminals yourself, with or without Fibo:

# phys_footprint of one process at this moment, in bytes
footprint -f bytes -p <pid>

07 All four routes side by side

Tauri + xterm.jsP1 GPUI + alacrittyP2 Swift + GhosttyKitP3 GPUI + libghostty-vt
Memory1029 MiB *287 MiB296 MiB288 MiB
CPU15% *5.4%3.4%5.9%
Idle0.3% when minimized42 MiB / 0.80%58 MiB / 0.07%42 MiB / 0.86%, 0.07% patched
4 panes, real Codexnot measured327 MiB / 11.2%377 MiB / 8.3%328 MiB / 13.2%
esctest2 passes101 (alacritty in the background)101147147
Chinese inputbuilt into xterm.js, not testedGPUI's IME interface, not testedbuilt into GhosttyKit, not testedpassed a hand test on the first build's day
Upkeepreuses the Tauri code; needs a hand-written alacritty → xterm.js state mirrorGPUI patches; 1.29 GiB for 40 sessions in the background, no snapshotsthe client carries its own full VT state; 536 MiB / 39% on 4 synthetic panesa GPUI patch set to maintain; two dependencies pinned to commits; Zig in the build
Verdictrejected: 3.56x memory, in the GPU processcontrolfallbackchosen
P1 to P3: one pane of the real Codex recording, median of 5; Ghostty.app measured 316 MiB / 9.8%. * Different load: one pane of synthetic output at 400 KiB/s, a single run; Ghostty in the same batch measured 289 MiB / 14%.

P2 had the lowest single-pane CPU, so why P3? Each route had one item that failed or was unknown: GPUI's idle CPU missed the line and needed a patch; P2 used the most resources under heavy 4-pane output, 15% more memory than GPUI on real Codex. The 4-pane Ghostty baseline was never measured, so neither could be judged against 1.2x. What decided it was structure:

On the afternoon of October 20 the testing stopped at the patch rerun, and the route was set as GPUI + libghostty-vt. Swift + GhosttyKit stayed as the fallback, with three written conditions, any one of which would reopen the question: an item on the Chinese input checklist fails and cannot be fixed within one iteration; the idle patch cannot be maintained (upstream reworks the display link and the patch has no replacement), or no threshold gives both idle ≤ 0.5% and unharmed 4-pane bursts; or a 4-pane baseline shows GPUI over 1.2x while P2 is not.

08 Chinese input: the one hard gate

When the route was chosen, none of the input-method checks had run; the prototypes had no IME at all. It was the only gate the evaluation called hard, and Zed had two open Chinese IME issues at the time (zed#59882, intermittent failure; zed#53537, shortcuts failing under third-party IMEs). So the first real build had to pass it the same day, or the plan would switch to P2.

How the first build does it: text being composed (marked text) lives only in the window's memory and never enters the PTY; it is drawn at the terminal cursor with an underline, and the terminal's own block cursor is hidden meanwhile. The candidate window's position comes from bounds_for_range, which uses the same measured font metrics as drawing and PTY resizing, with ranges converted as UTF-16 so surrogate pairs are never split. Measured Menlo cells were 7.525635 × 20 px; a Chinese character's advance was 15.051269 px against 15.051270 px for two cells, so wide characters align to two cells with no gap between them.

Input check (10-20)ResultHow it was checked
Candidate window hugs the terminal cursorpasshand test with a third-party pinyin IME, real cat in the window
After switching between two panes, pinyin goes to the focused onepasssame
A chosen word is committed once, nothing left overpassautomated keystrokes n/i/h/a/o then Space, checked by screenshot
Return commits Latin letters; Backspace during composition only removes pinyinpasssame
Spacing of Chinese, Japanese and Korean outputpassscreenshot of a real window
Ctrl-C exits catfailhand test; filed as a key-encoding bug and fixed in the next round

The gate was passed and the fallback was not triggered. The record also states what was not covered: the full path with Apple's built-in pinyin got no valid evidence from the automated round (keys reached the window, but the system IME did not take over). Choosing words, Return and Backspace had been confirmed by hand in an earlier round, and the candidate window and pane switching were hand-tested with a third-party pinyin IME.

09 The price: a patch set, a month later

Choosing GPUI meant maintaining patches from the start. As of November 28, Fibo is still pinned to the versions the evaluation used, Zed v1.24.3 (2a857f5) and libghostty-rs 0ef8041, fetched and patched in order by bootstrap.sh. The one patch from the evaluation has become six:

PatchWhat it doesLines
gpui-idlethe idle display-link pause above; Fibo turns it on at startup (GPUI_PAUSE_IDLE_DISPLAY_LINK=1)89
gpui-retained-backbufferkeeps the back buffer and redraws only what changed between frames, so a spinner repaints a few cells820
gpui-present-render-passcopies the back buffer to the screen with a render pass instead of a blit: window graphics memory 408.4 → 248.4 MB, total about 570 → 385 MB110
gpui-retained-group-rectsmerges several damaged regions into one Metal render pass189
gpui-fit-truncated-rowadds an ellipsis when text is cut off107
gpui-glyph-dilationlets a run of text use a fixed glyph dilation instead of the color-based default; one place in Fibo's terminal drawing uses it to turn thickening off47

The six patch files add up to 1362 lines, most of it the retained back buffer. present-render-pass is a typical case: the first time a process used a blit, the Metal driver kept 20 extra 8 MB buffers and never returned them while the window kept drawing, and a minimal Metal program of a few dozen lines did the same. With a render pass instead, the screen buffer and back buffer matched byte for byte over 194 frames of a real window. Problems like this can be fixed at our own layer only because the framework is ours to patch; the cost is that every GPUI upgrade means reworking all six patches, which is why there has not been one.

To keep later changes from quietly undoing this, window redraw cost now has a CI gate: on real hardware it compares retired instructions per frame with a baseline and fails above 15% (CI's virtual machines cannot read instruction counts and fall back to ratio checks). Details are in the repository's docs/performance/.

Limits: what was not measured

Summary: three practices