Editorial illustration for Claude Code uses React to render its TUI, functioning like a small game engine
Claude Code: React Turns AI Terminal into Game Engine
Claude Code uses React to render its TUI, functioning like a small game engine
Claude Code isn’t just another text‑based interface. Built on React, it rebuilds its entire display on each tick, turning raw layout data into a pixel‑perfect screen before checking what changed. That per‑frame pipeline feels more like a rendering loop than a static terminal app.
For most users, the first impression is a straightforward TUI—something you type into and get back plain text. Yet the underlying mechanics involve state construction, layout calculation, screen conversion and diffing on every frame, a pattern more commonly seen in lightweight game engines. This architectural choice reshapes how developers think about performance, interactivity, and the limits of terminal‑based tools.
It also raises questions about how we classify such systems. As Shihipar puts it:
> "Most people's mental model of Claude Code is that 'it's just a TUI', but it should really be closer to 'a small game engine'," he said. He added that on every frame, Claude Code constructs a UI state, calculates the layout, converts it into a screen representation, compares it with the previou…
"Most people's mental model of Claude Code is that 'it's just a TUI', but it should really be closer to 'a small game engine'," said Shihipar. He said that on every frame, Claude Code constructs a UI state, calculates the layout, converts it into a screen representation, compares it with the previous frame, and generates the minimal ANSI instructions needed to update the terminal. "We have a ~16ms frame budget, so we have roughly ~5ms to go from the React scene graph to ANSI written." In December, Shihipar explained the technical cause of terminal flickering.
Terminals contain a viewport and a scrollback buffer, and when content exceeds the viewport, rendering occurs offscreen. "Unlike regular CLI tools that print output and exit, Claude Code is a long-running interactive UI. We redraw our viewport dozens of times per second," he said.
To address this, Anthropic rewrote the rendering system to diff individual terminal cells and emit only minimal ANSI escape sequences instead of full redraws. Full redraws are now used only when necessary, reducing flickering by roughly 85%. Shihipar said the team considered using an alternate screen mode, similar to tools like Emacs, which would allow full control over scrolling and rendering.
Will the new engine deliver smoother interactions? The answer depends on how the rewritten pipeline behaves across the myriad terminal configurations that plagued the previous version. Anthropic’s engineer, Thariq Shihipar, announced on X that the overhaul was a legacy migration, swapping the old renderer for a React‑based system while promising no user‑facing regressions.
Yet the post admits that earlier bugs included excessive garbage‑collection triggers, a symptom of the former rendering approach. By treating each frame as a full UI state—calculating layout, converting it to a screen representation, then diffing it against the prior frame—Claude Code now resembles a small game engine—it's more than a traditional text interface. This architectural shift may reduce the inconsistencies that users reported, but concrete performance metrics remain undisclosed.
The claim that the rewrite eliminates regressions is reassuring, though without independent testing the extent of improvement is still uncertain. As the tool rolls out, developers will be watching to see whether the React‑driven TUI lives up to its intended stability.
Further Reading
- Claude Chill: Fix Claude Code's flickering in terminal - Hacker News
- Building a full CLI tool with spec-kit (spec-driven development) and Claude Code - Ancuta.org
- A Guide to Claude Code 2.0 and getting better at using coding agents - Bearblog
- ralph-tui - Ralph TUI connects your AI coding assistant (Claude Code, OpenCode ... - GitHub
Common Questions Answered
How does Claude Code use React to render its terminal user interface (TUI)?
Claude Code rebuilds its entire display on each tick, functioning like a small game engine rather than a traditional terminal app. The system constructs a UI state, calculates layout, converts it to a screen representation, and generates minimal ANSI instructions to update the terminal within a ~16ms frame budget.
What makes Claude Code's rendering approach different from traditional terminal applications?
Unlike static terminal apps, Claude Code uses a per-frame pipeline that resembles a game rendering loop. The system constructs a React scene graph, calculates layout, converts to a screen representation, and performs frame-by-frame diffing to minimize terminal updates.
What performance challenges did Claude Code's new rendering approach aim to address?
The previous version suffered from excessive garbage-collection triggers and rendering inefficiencies. The new React-based system aims to deliver smoother interactions by optimizing the rendering pipeline and reducing performance overhead across different terminal configurations.