Why Claude Code Migrated to Bun — and What It Signals for AI Tooling

Anthropic's Claude Code is now running on Bun. Not a minor dependency swap — the entire CLI runtime shifted away from Node.js to Bun, a JavaScript runtime whose core is implemented in Zig and increasingly leans on Rust for performance-critical subsystems. For most users the change is invisible. For engineers who build or maintain developer tooling, it is worth dissecting.

What Bun Actually Is — and Is Not

Bun is often pitched as a "fast Node.js alternative," which undersells and misrepresents it at the same time. Bun is a full JavaScript runtime, bundler, test runner, and package manager rolled into one binary. It achieves its speed primarily through two decisions:

  • JavaScriptCore instead of V8. Apple's JSC engine starts faster and, in many workloads, executes tighter loops more efficiently than V8 — though V8 still wins on long-running, heavily optimized paths.
  • Systems-language internals. The Bun team wrote the runtime in Zig, with Rust handling specific subsystems where the ecosystem or memory-safety guarantees made sense.

This is not a JavaScript runtime that happens to be fast. It is a ground-up reimagining of what a JavaScript runtime should look like when startup latency and binary size actually matter.

Why This Choice Makes Sense for a CLI AI Agent

Claude Code is a terminal-based agentic coding assistant. Users invoke it constantly — sometimes dozens of times in a single session. Every millisecond of cold-start time is felt. Node.js carries non-trivial startup overhead because of how it initialises V8, loads its module graph, and bootstraps native addons. Bun's startup time is measurably lower, often by 2–4× on equivalent workloads.

There is a second, less obvious reason: single-binary distribution. Bun can compile a TypeScript or JavaScript project into a self-contained executable. For a CLI tool like Claude Code — which needs to work reliably across macOS, Linux, and Windows without requiring users to manage Node versions — a single compiled binary dramatically simplifies the distribution story. No nvm, no version mismatch errors, no node_modules headaches.

# What Bun's compile step looks like for a CLI tool
bun build ./src/index.ts --compile --outfile claude-code
# Produces a single, self-contained binary — no runtime dependency required

This is the kind of developer experience detail that separates polished tools from good-enough tools.

The Rust Angle — Precision Over Hype

The headline says "written in Rust," which requires some precision. Bun itself is primarily Zig. Rust appears in specific subsystems — cryptographic operations, certain I/O paths, and components where pulling in the mature Rust crate ecosystem was more pragmatic than reimplementing from scratch in Zig. Anthropic is not rewriting Claude Code in Rust. They are benefiting from Rust-powered components indirectly, through Bun's internals.

That distinction matters because it reflects a more sophisticated engineering posture: use the right tool for the right layer. The AI logic, prompt orchestration, and tool-calling abstractions remain in TypeScript — a language with excellent ergonomics for this kind of compositional, event-driven work. The systems-level performance is delegated to lower-level runtimes. This is layered architecture working as intended.

What This Means for Teams Building AI-Native Tooling

If your team is building a CLI tool, a developer assistant, or any AI-powered product that gets invoked from a terminal or embedded in an IDE, three lessons apply directly:

1. Cold-start latency is a UX problem, not just a performance metric

Users form instant impressions of CLI tools. A 300ms startup feels snappy. An 800ms startup feels broken, even if everything downstream is fast. If you are still defaulting to Node.js for CLI tooling, benchmark Bun seriously. The migration is often low-friction — Bun has excellent Node.js compatibility.

2. Single-binary distribution reduces support burden dramatically

Every "it works on my machine" issue that involves a missing runtime is a support ticket you could have avoided. Bun's --compile flag is not perfect yet — native addons and some edge cases still bite — but for pure TypeScript/JavaScript CLIs it is production-ready and worth evaluating.

3. The Rust ecosystem is infrastructure, not identity

There is a tendency in some engineering cultures to treat "rewrite it in Rust" as a strategy. The smarter reading of what Bun (and by extension Claude Code) demonstrates is that Rust is best treated as a library of high-quality, safe, fast primitives that you pull in where they solve a real problem. You do not need to commit to Rust as your primary language to benefit from it.

The Broader Signal: AI Tooling Is Maturing Fast

A year ago, most AI coding tools were thin wrappers around REST APIs, packaged hastily and distributed as npm globals. The shift to Bun-as-runtime for a flagship Anthropic product signals that the category is maturing. Teams are now thinking seriously about startup performance, binary size, cross-platform reliability, and offline behaviour — the same concerns that professional CLI tooling has always demanded.

This is a healthy development. AI-native tools that feel like first-class developer tools — fast, reliable, and unobtrusive — will win adoption over technically impressive but clunky alternatives, regardless of the underlying model quality.

Source: Simon Willison's Weblog — https://simonwillison.net/2026/Jul/19/claude-code-in-bun-in-rust/


Why this matters for your project: Whether you are building a custom AI assistant, an internal developer tool, or a SaaS CLI companion, the runtime you choose shapes the experience your users have before your product logic even runs. Evaluating Bun for TypeScript-based tooling — and understanding where Rust-powered components can replace slower alternatives — is a concrete engineering decision with measurable user-facing impact. At Code!nk Technologies, we factor these infrastructure choices into every AI and software product we ship.