Nov 23, 2026

rust-anything: Rewrite Your App in Rust and Prove It Behaves the Same

rust-anything records what your app does, bridges the Rust port so callers keep the original API, and replays every recorded case against the rewrite — your agent writes the Rust, and the gate decides what ships.

#tutorial#engineering#developer-tools

A rewrite that drifts is worse than a rewrite that fails. rust-anything — an 8k-star CLI, MCP server and agent skill — makes the drift visible: it records what your app does today, then refuses to ship any piece of the Rust rewrite until every recorded case replays identically. "It doesn't translate code," the README says; your coding agent writes the Rust, and rust-anything supplies what the agent cannot guess reliably.

Why This Skill Matters

The README splits the workflow into four stages:

StageCommandWhat it does
RecordrecordRuns the original on generated edge cases, semantic traps and your own inputs, and saves what it returns or throws
PortbridgeGenerates the Rust crate and a wrapper, so callers keep the original API; you or your agent write the Rust
CheckdiffReplays every recorded case against the Rust; nothing ships until they all match and gate passes
Liftapp liftWhen replay passes with no fallback and every unit passes gate, makes it a pure Rust app — the original is never touched

The README targets Node.js (TypeScript/JavaScript), Python, C, Go, Ruby, Java or Kotlin apps. The bridge layer is built on napi-rs, PyO3 and wasm-bindgen, which carry the calls between your language and Rust.

The README backs the approach with measured ports: Prettier runs 19x faster over 2,360 JS/TS files (128.6 s to 6.9 s on an Apple M4), with 15,861 of 17,224 recorded runs executing fully in Rust and all 17,224 matching Prettier byte for byte — anything not ported yet falls back to Prettier. json-server, lifted to one binary, idles at 3.5 MB instead of 74 MB with 514 of 514 recorded HTTP cases matching; Fuse.js search over 50,000 strings drops from 91.2 ms to 2.8 ms per query.

Installation

No Rust toolchain yet? The README documents two shortcuts: prebuilt binaries for macOS, Linux and Windows attached to each GitHub release, and npm install -g rust-anything for JavaScript projects. Otherwise:

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

setup adds the MCP server to each agent it finds and installs the workflow skill where the agent reads skills. It saves a copy beside any existing file it changes (<file>.rust-anything.bak), is safe to run again, and --remove undoes it. In Claude Code you can also install it as a plugin (the CLI above must be on your PATH):

/plugin install rust-anything --marketplace erkamyaman/rust-anything

For Codex, the README documents a two-command path through the agents marketplace in this repo:

codex plugin marketplace add erkamyaman/rust-anything
codex plugin add rust-anything@rust-anything

Real Workflow: Port the One Function That Is Too Slow

You do not have to port the whole app. Point go at a command that is too slow:

rust-anything go --agent claude -- python3 app.py

Per the README, it profiles the run, picks the outermost function worth moving, records it on generated inputs plus the calls your run makes, and hands src/port.rs to your agent — claude, codex, or any command that reads a prompt on stdin; without --agent it writes TASK.md for you and stops. It switches the function on only when every recorded case matches and gate passes. Then:

rust-anything report rust/dedupe-rs     # REPORT.md and card.svg for the pull request
rust-anything disable rust/dedupe-rs    # back to the original, byte for byte

If you would rather drive each step yourself, the README's manual sequence is:

rust-anything profile . -- node bench.mjs              # what is hot, and who calls it
rust-anything bridge . src/fuzzy.ts --batch fuzzyScore:text
# write src/port.rs (or let your agent), then:
rust-anything record rust/fuzzy-rs && rust-anything build rust/fuzzy-rs
rust-anything diff rust/fuzzy-rs                       # every recorded case must match
rust-anything fuzz rust/fuzzy-rs --time 60 --keep      # fresh inputs: what the recording missed
rust-anything bench rust/fuzzy-rs                      # faster? the verdict says
rust-anything gate rust/fuzzy-rs                       # done means this passes

Tips

  • Output equivalence is not the whole bar. app record --effects smtp also records what the app sends — the README's own example is a rewrite that prints the same output but mails twice, and it fails replay with 0 of 2 cases passed.
  • fuzz feeds the port fresh inputs, catching what the recording missed.
  • Same behavior is not the same speed for small calls: the README notes that calling Rust once per small function is usually slower than a JIT, so let profiling pick the loop.
  • The README carries a warning worth copying: record and app record run your original code on many generated inputs, and code that writes files, talks to a database or calls the network does that once per case — run them on a copy of the project, with a test database and no production credentials in the environment.

When Not to Use This

The README is explicit about the ceiling: "It can only catch what the recording covers" — behavior no recorded case exercises is behavior the gate cannot defend. Against C, the README frames the win as safety rather than speed (its ffmpeg libavutil port matches all 226,447 recorded calls at about C's speed). And if your target function is small and cold, the profiling note above cuts the other way: the speedup lives in hot loops, not in one-off small calls.


See the leaderboard for more skills.