Skip to main content
Claude Code's terminal UI, built with React, displays code like a game engine, enhancing developer workflow [claude-ai.chat]

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

Updated: 4 min read

Most people see Claude Code and think “terminal tool.” Shihipar sees a game engine. Every frame, 16 milliseconds, Claude Code builds a UI state, calculates layout, converts it to a screen, diffs against the last frame, and emits the bare minimum of ANSI instructions. That’s roughly 5 milliseconds to go from a React scene graph to terminal output.

A long-running, interactive UI that redraws dozens of times per second can’t just dump text and exit. So Anthropic rewrote the rendering system to diff individual cells, cutting flickering by 85%. Full redraws only fire when necessary.

The result? A TUI that behaves less like a command-line script and more like a tiny, responsive game.

"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.

This isn’t just a technical curiosity. The React-to-ANSI pipeline, the 16ms frame budget, the cell-level diffing, they reshape what a terminal can be. Claude Code has quietly turned the command line into a game engine, complete with layout calculations and minimal update sequences.

The flickering? That was the symptom of a deeper tension: tools built to print and exit, forced to stay and interact. Anthropic solved it by treating every keystroke like a new frame, burning 5ms to translate React components into ANSI escape codes before the display refresh catches up.

That’s an architectural shift. The alternate screen mode they considered? It’s a road not taken, but the point is they could have taken it.

Instead, they chose to rewrite rendering from scratch, diffing cells rather than redrawing the world. This is where terminals are heading: not as scroll logs, but as persistent, reactive surfaces. Claude Code isn’t just a better CLI, it’s a proof of concept for what interactive software looks like when you refuse to accept the old constraints.

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.

LIVE11:52Anthropic expands voice mode to Gmail, Slack apps