Article Complete
AIM
Claude Code Uses React to Render its TUI
Claude Code Uses React to Render its TUI
Game Engine Lite

Claude Code Uses React to Render its TUI

ā€œ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’.ā€

Published Updated

Key takeaways

  • Rewrite of Claude Code’s terminal rendering system addresses bugs across various environments.
  • Transition to a new rendering engine aims to prevent user-facing regressions.
  • Claude Code functions more like a small game engine than a traditional TUI.
  • Optimize rendering to achieve a 16ms frame budget with efficient ANSI updates.
  • Improved redraw frequency enhances the interactive UI experience in long-running sessions.
5 min

Anthropic engineer Thariq Shihipar said Claude Code’s terminal rendering system had to be rewritten after bugs emerged across different terminal and operating system environments, including cases where the rendering pipeline triggered garbage collection too frequently.

He announced the update in a post on X on January 22. 

He said the rewrite was a legacy migration that required replacing the rendering engine while ensuring no user-facing regressions. 

Shihipar estimated that without Claude Code, the work could have taken one to two years for a single engineer in a large organisation, but clarified that the estimate was approximate and shaped by coordination costs, evolving codebases, and diverse user environments.

“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. “However, you no longer get native terminal experiences for things like Cmd+F search, text selection, and copy/paste,” he added. 

He said testing was initially limited, making the rewrite difficult. The team adopted property-based testing, generating thousands of random UI states across widths, content lengths, and Unicode edge cases, and comparing outputs between the old and new rendering systems.

Anthropic has rolled out the updated rendering system again to Claude Code users after previously rolling it back.

Membership

Stay ahead with AI insights.

Unlimited access to premium articles, exclusive analysis, and the stories shaping India's AI economy.

Subscribe now

AIM Americas

1190 Miraloma Way Suite P, Sunnyvale, CA 94085

AIM India

1st Floor, Sakti Statesman, Bellandur, Bengaluru – 560103

Ā© 2026 AIM. All rights reserved.