Hi all! I’d like to share WhyCodes, an open-source (MIT) coding agent for the terminal.
The whole interactive UI is Ratatui 0.30 + crossterm 0.29: a chat transcript with streamed
markdown, syntax-highlighted code and diffs, tool-call cards, dialogs and pickers.
A few Ratatui-side things I spent time on, in case they help anyone building something similar:
- Streaming markdown without re-rendering everything. A streamed reply only re-parses the
tail after the last stable markdown checkpoint, so each frame costs O(new bytes) instead of
O(whole message). An open code fence (whose closer hasn’t arrived yet) keeps its already
wrapped rows and only wraps new source lines, so highlighting doesn’t rebuild on every token. - Redraw cadence. Painting is gated on a dirty flag; the loop wakes every 16 ms while
something streams or animates, every 500 ms when idle, and every 5 s after 30 s without
input. An idle session draws 0 frames per second. Toasts and status notices are treated as
static text, not animations — an early version pulled the whole UI to animation FPS just to
show a 3-second notice. - Fast first frame: about 0.25 ms on Windows and 0.08 ms on Linux in our in-process harness.
It runs on Linux, macOS and Windows (no WSL), and works with hosted LLM APIs, local model
servers or any OpenAI-compatible endpoint.
Repo: GitHub - whycorporation/whycodes: A fast, provider-independent coding agent for the terminal, written in Rust. · GitHub
Install: cargo install whycodes-cli --locked (or curl -fsSL https://why.codes/install | bash)
Thanks to the Ratatui team — the widget model made the transcript view far easier than I
expected. Feedback on the rendering approach is very welcome.