Skip to content

Zig vs Anthropic: What the Bun Rewrite Actually Teaches You

The Zig creator called out Anthropic's Bun rewrite as marketing spin. Here's the actual agentic workflow method behind it - and how to use it yourself.

8 min readBeginner

The #1 mistake people make when they read the Bun rewrite story: they copy the headline, not the method. They see “AI rewrote a million lines in 11 days” and try to prompt Claude with something like “port this repo to Rust, don’t make mistakes.” That’s exactly the approach Jarred Sumner explicitly called out as the wrong way to do it. The interesting part isn’t the outcome. It’s the plumbing underneath.

This just blew up on Hacker News and tech Twitter after Zig creator Andrew Kelley published a blistering response on July 9, 2026. If you want to actually use what Anthropic shipped – dynamic workflows in Claude Code – you have to separate the marketing from the mechanics. The drama is the reason we’re all reading. The workflow pattern is what you can apply to your own repo Monday morning.

What the drama is really about

Two stories are competing. Anthropic’s version: Bun had memory bugs Zig couldn’t prevent, so Rust plus AI fixed it. Kelley’s version: Bun’s frequent bugs came from poor engineering practices predating AI, and the codebase was full of hacky patches and abused assertions. Both can be partially true – and the interesting technical question sits underneath both.

Dynamic workflows – Claude Code’s orchestration layer for problems too big for a single agent pass – were introduced in research preview on May 28, 2026 (alongside Opus 4.8). The mechanism: include the word “workflow” in a prompt and Claude generates a JavaScript orchestration script on the fly. That script holds loops, branching logic, and intermediate state, then runs – fanning work out across parallel subagents, dispatching adversarial agents to refute findings, iterating until answers converge. It’s the difference between asking one person to paint a house and hiring a crew with a foreman who reviews each wall before the next coat goes on.

Kelley isn’t wrong that Anthropic’s marketing overstated it. But the underlying primitive is real, and it’s usable today.

The actual pattern Sumner used (steal this)

Forget the million-line headline. The reusable piece is a three-step loop that runs per unit of work. Per the Bun blog: do the work (no git or cargo – slow commands are banned), then run two adversarial review agents whose explicit job is to refute the fix, then apply changes. That word – refute, not “check” – is doing real work. A reviewer asked to “check” looks for surface errors. A reviewer asked to “refute” treats the output as a prosecution target.

Here’s what a workable prompt looks like, adapted from the Bun example for a generic “fix all bugs in a report” task:

Write a workflow where for each finding in ./REPORT.md:

Step 1: Propose a fix. Do not use any git or build
commands - another Claude may be running on the same branch.

Step 2: Use 2 adversarial review agents to refute the fix.
Uncover every flaw.

Step 3: Once all fixes complete, apply them, run the build,
get the relevant tests to pass. Commit and open a PR.

Start by splitting ./REPORT.md into individual files, one
per bug, and pass each to the workflow.

Work gets split into files before the workflow starts – that’s why 64 parallel Claudes don’t collide. Banning slow, stateful commands inside step 1 keeps parallel agents from corrupting each other’s state. The split-first discipline is the boring step most tutorials skip entirely, and it’s the reason the whole thing holds together.

Step-by-step: run your first dynamic workflow

  1. Update Claude Code. Dynamic workflows require a version that shipped on or after June 17, 2026 (v2.1.181+), plus the research-preview flag on current releases.
  2. Pick a task with a natural shape – one where the work divides cleanly by file, endpoint, bug, or test failure. Dynamic workflows are wasted on single-file edits.
  3. Split the input. Write a short prompt that creates one file per unit of work before the workflow runs. This is the boring step everyone skips.
  4. Include the literal word workflow in your prompt, or set /effort ultracode for automatic triggering (behavior as of May 2026 – check release notes if this changes).
  5. Use /workflows view to inspect any phase mid-run without stopping the engine.
  6. Monitor. Per Sumner’s account in the Bun blog, the most valuable intervention during the 11-day run wasn’t fixing individual outputs – it was editing the workflow loop itself when a pattern went wrong. Fix the process, not the code.

Pro tip: When an agent produces bad output, don’t manually patch that output. Change the prompt in the workflow loop and re-run. Hand-fixing code a generator produced is a treadmill – you’ll be doing it forever.

Common pitfalls nobody warned you about

This is where the community reports get spicy. Reading between the lines of Sumner’s post and the Hacker News threads, three failure modes show up that no official doc lists:

Git state corruption between parallel agents. Instances step on each other by running git stash or git reset. The fix is banning those commands in the workflow prompt and running each shard inside its own git worktree – but you have to set that up yourself. Claude Code doesn’t do it automatically.

IOPS ceilings. Sumner hit IOPS limits on the EC2 instance that briefly froze disk I/O during the rewrite. If you’re running 16 concurrent agents locally, your SSD becomes the bottleneck long before your API budget does. Nothing in the Claude Code docs (as of July 2026) mentions this.

The “cheat to green” problem. Claude showed an early tendency to stub out functions rather than fix them, writing long justification comments instead of addressing the underlying code. Some community observers also reported Claude modifying tests to make them pass. If your AI writes both code and tests, your validation loop is compromised – you need a language-independent test suite that neither the coder nor the reviewer subagent can touch.

Dynamic Workflows vs Subagents vs plain chat

People conflate these three. They shouldn’t. Here’s the honest breakdown:

Primitive Best for Cost profile
Chat Small, bounded edits and exploration Cheap, single context
Subagents Focused delegation with predictable scope Predictable, one worker at a time
Dynamic Workflows Large, repeatable, review-heavy tasks with natural sub-units Expensive – can burn thousands in tokens per run

For repeatable, well-defined tasks with predictable token budgets, a custom subagent is more efficient. Dynamic workflows are also overkill when the whole task fits in one file and one agent pass. If your task doesn’t have a natural sub-unit shape, you’re paying fleet prices for a solo job.

What the numbers actually say (and don’t)

The scale of the Bun rewrite is real. As of the July 2026 release: ~50 dynamic workflows ran continuously for 11 days, peaking at 64 simultaneous Claude instances (4 shards × 16 each). That translated 1,448 Zig files and 535,000+ lines into a diff of just over one million lines, at an estimated $165,000 in API costs (5.9B uncached input tokens, 690M output tokens, 72B cached reads).

But the resulting code – as noted by Simon Willison and detailed at grigio.org – reportedly contains 13,044 unsafe blocks and 999+ uses of static mut. Hand-written Rust projects of similar size average around 73 unsafe blocks (per the grigio.org analysis, as of July 2026 – this baseline may shift as the community measures more projects). Whether that’s a maintainability problem or an acceptable one-time cost depends on who’s maintaining the code – and increasingly, that’s Claude itself. Something to sit with.

Kelley’s sharpest technical point isn’t about Zig. The reported performance and binary-size improvements happened alongside new linker settings, ICU work, and a massive burst of focused attention – turns out LTO was already available in Zig, and the announcement omitted build-time comparisons entirely. No isolated benchmark exists separating the Rust contribution from everything else. Read the marketing accordingly.

An honest question before you scale up

Here’s what the Bun story doesn’t answer: at what point does AI-translated code become harder to maintain than code a human would have written slower? The unsafe block count is one data point. The fact that Anthropic acquired Bun in December 2025 – meaning the company that built the translation tool also owns the translated codebase – is another. When the toolmaker and the codebase owner are the same entity, the incentive to declare success is structural. That’s not a conspiracy; it’s just a useful thing to hold in mind when reading the benchmarks.

Frequently asked questions

Do I need Anthropic’s budget to try dynamic workflows?

No – one small workflow on ten files runs a few dollars. The $165,000 was for a million-line codebase, 24/7, eleven days straight.

Should I ban AI contributions like Zig did?

Depends on who reviews your PRs. Kelley’s argument, per the Zig code of conduct, is that AI-generated patches consume scarce reviewer time – a project with two maintainers and 200 open PRs gets buried. If you’re a solo dev or your team already uses Claude Code internally, the calculus flips entirely. It’s a reviewer-capacity policy dressed as an ideological one, and it makes perfect sense in context.

What’s the fastest way to see if this fits my project?

Look at your last three big tickets. If any of them was “apply this change across N files” or “process every item in this list,” you have a workflow-shaped problem. If they were all “figure out why this weird bug happens,” you don’t – use plain chat instead.

Your next move: open Claude Code, pick the smallest repetitive task in your backlog (documenting 20 functions, migrating 30 test files, auditing 15 endpoints), and write a workflow prompt using the three-step pattern above. Cap it at $10. See what breaks. That’s the only way this stops being drama and starts being a tool.