[ANN] Mosaic - A Modern Terminal User Interface Framework for OCaml (Early Preview)

Regarding the LOC: a large portion of the OCaml count comes from programmatically-generated Toffee tests (about 190k lines across 1000 files), which of course I did not review line by line. Without tests, examples, and docs, the core libraries are roughly: 11k LOC for Matrix, 16k for Mosaic, 12k for Toffee.

This spans several subsystems: ANSI sequence parsing, Unicode/grapheme handling, terminal grid diffing, virtual terminal emulation, PTY handling, the rendering tree, reconciler, widgets, charting, and the TEA runtime. So the overall footprint is naturally fairly large.

Since some of your comments seem to imply that the code was generated and pushed without oversight: that’s not the case. I do use AI extensively in my workflow, and I’ve spoken about that openly in the context of Raven. AI writes a significant amount of the initial code, and I review, revise, and iterate on a large portion of it. That’s how I work these days. But the architecture, design, and core logic are very much the result of deliberate iteration and manual refinement. I’ve been working full-time on this version of Mosaic for the past couple of months (and longer before that as one can see on the commit history), going through multiple iterations of the design and implementation and spending a significant amount of time reviewing and refining the code.

As with any project of this scale, parts will continue to evolve, and I’m always open to concrete, actionable feedback.
I’d prefer to focus on specific technical issues rather than debating assumptions about intent or workflow, so if you or others have particular concerns, feel free to open focused issues and we can address them constructively.

On the performance side: you can see the benchmarks at mosaic/matrix/bench at main · tmattio/mosaic · GitHub. I’ll publish comparative benchmarks with Notty and other libraries when I have time to set them up properly.

4 Likes