Developer tools#Code generation#Coding agent

rust-anything proves a piecewise Rust rewrite against recorded behavior

rust-anything records what an app does, lets a coding agent port it to Rust piece by piece, and checks each piece against the recording.

Project facts

GitHub Ecosystem
Repositorygithub.com/erkamyaman/rust-anything
License
MIT
Language
Rust
Stars
6,601
Data checked
2026-11-20

Snapshot figures reflect the check date and may change over time.

“Rewrite it in Rust” usually means a risky big-bang port: the new code is fast, but nobody can prove it behaves like the old one. rust-anything flips the order — record what the original app does, have a coding agent move it to Rust one piece at a time, and check every piece against that recording before moving on. The project’s own summary: “It doesn’t translate code; it proves the rewrite.” GitHub’s API reported 6,601 stars on November 20, 2026; the repository was created on November 16.

Core features

  • Record first, rewrite second: record runs the original on generated edge cases, semantic traps and your own inputs, saving each return value and thrown error; app record runs every case twice so the recording itself is reproducible.
  • Prove equivalence piece by piece: diff replays all recorded cases against the Rust implementation and blocks on any mismatch; gate runs as a pre-commit check. Nothing is rewritten all at once — the port advances module by module.
  • Broad language coverage: CLIs, HTTP servers and libraries in Node.js (TypeScript/JavaScript), Python, C, Go, Ruby, Java and Kotlin; PHP and C# currently support record, replay and “front door” integration, with unit ports on the roadmap.
  • A real-world result: version 2.0 ports Prettier to Rust — 15,837 of 17,224 recorded runs format fully in Rust, and all 17,224 outputs match Prettier. The project reports about 19x faster on an Apple M4 across two averaged runs.
  • Plugs into existing agents: rust-anything setup registers its workflow with Claude Code, Codex, Cursor, Gemini CLI and OpenCode, so you can tell the agent to “profile with rust-anything and move the hot loop to Rust.”

Typical use cases

  • Moving a hot path: find the slowest loop or function in a Node or Python service, record it, and port just that unit with record + diff keeping the blast radius inside one function.
  • Incremental rewrites of older services: the json-server example drops idle memory from 74 MB in the Node version to 3.5 MB in a single Rust binary, with a shorter first response — every step backed by recordings rather than a compare-after-the-fact.
  • A cross-language regression harness: even without rewriting, record + diff works as a behavioral comparison tool across language implementations; it catches behavior differences, not style.

Quick start

The README’s install and setup commands:

cargo install rust-anything   # from crates.io
rust-anything setup           # registers with Claude Code, Codex, Cursor, Gemini CLI, OpenCode

Then run the loop inside a project: record, write Rust piece by piece, diff, gate. A Claude Code plugin path is also documented (/plugin install rust-anything --marketplace erkamyaman/rust-anything). The README is explicit that it only catches what the recording covers; timing, resource use and untriggered branches still need human judgment.

One detail is easy to miss: the proof only covers the functions the recording exercises and the inputs it generates. Untriggered branches, concurrency timing and resource limits fall outside, and the README documents these limits under “What it can’t catch” — read it before deciding which modules to move and which inputs to record.

Summary

rust-anything turns “rewrite” from a matter of faith into a verifiable process: behavior recordings as the baseline, piecewise ports as the increments, and a gate as the enforcement point. It is not a silver bullet — the quality of the recording bounds what can be proven, and cross-language semantic differences such as exceptions and numeric precision still need review. GitHub’s API reported Rust, MIT, 6,601 stars, an unarchived repository and a push the same day, on November 20, 2026.

This entry is based on the README and official examples; we did not run a migration. Speed and memory figures come from the project’s own benchmarks — run record/diff on your project before relying on them. For the same evidence-loop idea applied to AI-written changes, see our Claude Code verification article.