erkamyaman/rust-anything is a parity-first migration harness, not a transpiler: it records what your existing app does, lets a coding agent write Rust in port.rs, and refuses to ship until diff, bench, shadow, and gate agree the new code matches. The repo gained more than 2,500 GitHub stars within days of its November 16, 2026 creation date, according to the project's trending metadata and README counters.
If you have been following AWS-style parity migrations (Kiro's PHP-to-Java engine) or agent skills that force primary sources (imozuru), rust-anything applies the same discipline to Rust: behavior is law, Rust is the optimization.
TL;DR: commands and outcomes
| Step | Command | What you get |
|---|---|---|
| Find heat | rust-anything profile . -- node bench.mjs | Hot paths and call graph hints |
| Scaffold | rust-anything bridge . src/unit.ts --batch fn:arg | Crate, bindings, port.rs stub |
| Truth set | rust-anything record rust/unit-rs | cases.jsonl from original |
| Proof | rust-anything diff rust/unit-rs | Replay cases against Rust |
| Speed | rust-anything bench rust/unit-rs | Original vs Rust timings |
| Safe rollout | rust-anything shadow rust/unit-rs | Both run; original answer wins |
| Done | rust-anything gate rust/unit-rs | fmt, clippy, tests, API contract |
What problem rust-anything solves
Big-bang rewrites fail because nobody trusts the new binary. Small rewrites fail because callers break when one function changes semantics. rust-anything keeps the original API while swapping internals:
- Profile where time goes (not where architects guess).
- Bridge so TypeScript, Python, Go, Ruby, Java or C callers still invoke the same symbols.
- Record outputs and errors on generated edge cases plus optional test-suite captures.
- Diff every case against Rust before merge.
- Shadow in production-shaped environments so mismatches surface without user impact.
- Gate with clippy-deny and error-path coverage requirements.
The README claims 38,251 recorded cases replayed with zero mismatches on published demos and cites measured speedups such as 20x on an x18n sidebar search path and 17x on a Python slugify loop. Treat those as author benchmarks until you run bench on your hardware.
Green blocks crossing a bridge, illustrating rust-anything parity migration workflow
Languages and bridges (November 2026)
| Language | Bridge tech | Recorder runs |
|---|---|---|
| TypeScript / JavaScript | napi-rs or wasm-bindgen | Node against .ts sources |
| Python | PyO3 (abi3) | Python importing originals |
| C | extern "C" + ctypes | Shared library from .c |
| Go | cgo + binary wire | Generated Go driver module |
| Ruby | magnus extension | Generated Ruby driver |
| Java | JNI + binary wire | Reflection driver |
| PHP (preview) | Planned FFI | Whole-app app record / app replay today |
| C# (preview) | Planned P/Invoke | CLI and ASP.NET via app record |
Batch classes (--batch) keep collections in Rust and fan work across cores — the pattern behind demo speedups on tight loops.
Language detection reads go.mod, pom.xml, .csproj, pyproject.toml, Gemfile, composer.json, or package.json, with --lang override when repos are messy.
The agent workflow (MCP + skills)
rust-anything setup is the onboarding spine:
- Registers
rust-anything mcpas a stdio MCP server in Claude Code, Codex, Cursor, and Gemini CLI when those configs exist. - Installs
skills/rust-anything/SKILL.mdwhere the agent reads skills (Claude and Codex paths documented in README). - Backs up touched config files as
*.rust-anything.bakbefore edits.
Claude Code users can alternatively run:
/plugin install rust-anything --marketplace erkamyaman/rust-anything
Typical agent prompts from the README:
- "Rewrite this CLI in Rust with rust-anything, end to end, and prove it behaves the same."
- "Profile it with rust-anything and move the hot loop to Rust."
- "Bench the Rust port and tell me whether to ship it."
That lines up with how explainx.ai covers loop engineering for coding agents and external sandboxes: agents need machine-checkable stop conditions, not vibes.
Two pipes joined by an adapter, illustrating rust-anything bridge between original and Rust
Whole-app mode: CLI, HTTP servers, libraries
Beyond single functions, rust-anything can treat programs as black boxes:
rust-anything app record . -- python3 cli.py
rust-anything app replay .
rust-anything app front-door .
rust-anything app wire . textkit --command upper
rust-anything app lift .
app record harvests cases from documented examples, --inputs JSONL, and semantic traps (unicode, overflow, missing files). Cases land as trycmd fixtures under rust/app-cases/ so humans and CI can edit them.
app front-door scaffolds a Rust binary that proxies every command to the original, tracking fallback rates.
app wire routes specific commands through gated unit crates.
app lift removes fallbacks only when replay hits zero fallback and every unit passes gate — the moral equivalent of a feature flag reaching 100% Rust.
HTTP servers follow the same story with --http, axum front doors, and route-level wiring (GET /users/{id} patterns in README).
Whole-app mode borrows grilling / research / HANDOFF practices adapted from Matt Pocock's skills: agents write ADRs in rust/DECISIONS.md, spawn research files per dependency, and leave rust/HANDOFF.md between sessions so multi-day ports do not lose state.
How this compares to other migration paths
| Approach | Strength | Gap rust-anything fills |
|---|---|---|
| Manual rewrite | Full control | No shared record of "correct" behavior |
| LLVM / wasm-only speedups | Fast to try | Hard to prove equivalence on errors and edge types |
| AWS Kiro parity engine | Enterprise Java moves | Different target language and cloud context |
| LLM "rewrite to Rust" prompts | Fast first draft | No enforced diff against production behavior |
rust-anything is closest to test-record-replay culture in compilers and finance systems, but packaged for agentic coding with MCP tools (profile, bridge, record, diff, bench, shadow, gate, plus app commands).
MCP tools your agent actually calls
rust-anything mcp exposes the CLI as structured tools so agents do not guess shell flags. Typical surface (see repository mcp docs for the authoritative list):
| Tool theme | Purpose for agents |
|---|---|
| profile | Emit hot-path graph before anyone writes Rust |
| analyze | Whole-app port order, risks with file lines, dependency-to-crate map |
| bridge | Create crate skeleton and foreign bindings |
| record / build / diff | Close the proof loop on cases.jsonl |
| bench | Compare latency including bridge overhead |
| shadow | Dual-run with production-safe answers |
| gate | Single pass/fail for "ship it" |
| app record / replay / wire / lift | Black-box CLI and HTTP migration |
Agents that skip record and jump to port.rs will fail gate — by design. That is the difference between this repo and a README that says "rewrite in Rust."
Shadow mode and production cutovers
rust-anything shadow runs both implementations and returns the original answer while logging mismatches. Set RUST_ANYTHING_MODE=old|shadow|new to stage confidence:
- old — baseline only.
- shadow — Rust executes; users still see legacy output unless you inspect logs.
- new — Rust answers after gate and shadow periods look clean.
This mirrors feature-flag discipline in agent systems: never let the model choose when it is live.
For HTTP servers, axum front doors proxy to the legacy process until app wire moves routes. app lift is the point of no return — the README refuses lift until fallback hits zero and every unit passes gate.
Risks and honest limits
The README's "What it can't catch" section matters: recordings only cover explored input space. Concurrent behavior, performance races, and security properties need their own tests. Preview PHP and C# FFI ports are not full parity bridges yet. Agents can still hallucinate unsafe Rust — gate catches some patterns (unwrap bans, missing error paths) but not logic bugs diff never triggered.
Running setup mutates local agent configs; read diffs and keep the .bak files until you trust the install. The project disclaims Rust Foundation endorsement — comply with Rust trademark guidance if you ship branded binaries.
For teams comparing on-device agents, pair this with mobile SLM factory patterns only when your bottleneck is actually CPU in a hot loop — not API latency.
When rust-anything is the wrong tool
Skip it when the goal is greenfield Rust with no legacy contract — plain cargo new is faster. Skip it when behavior is nondeterministic (wall-clock, random IDs, live market data) unless you invest heavily in normalizers (app record supports timestamp and UUID wildcards, but someone must maintain them).
Skip it when legal requires formal verification beyond parity tests; gate is engineering rigor, not proof. In those cases, pair recorded parity with separate property tests or manual audits.
Stars, velocity, and what to verify locally
GitHub trending metadata quoted 2,505 stars gained in roughly two days from a November 16 createdAt stamp — impressive distribution, not a maturity certificate. Before you bet a quarter on it:
- Run
diffon your worst legacy function (unicode, error branches,-0floats). - Read CHANGELOG.md for breaking CLI changes — the repo had 208 commits when we fetched.
- Confirm LICENSE fits your shipping model.
Trending rank tells you builders are looking; gate tells you whether your app can move.
Analyze and grilling before any Rust ships
rust-anything analyze . --whole-app is the planning phase serious teams should not skip. It emits port order as pieces (tightly coupled units move together), file:line risks (integer overflow, loose comparison, async boundaries), and a dependency-to-crate map so agents do not import the wrong Rust ecosystem crate for each library you already use.
The grilling step forces explicit decisions: naming in rust/GLOSSARY.md, ADRs in rust/DECISIONS.md, and rust/MAP.md state per unit so the next agent session does not reopen settled calls. That is borrowed from Matt Pocock's agent skills culture — the same "write decisions down" ethic we highlight in DESIGN.md templates for agent UI work.
If you are porting only one hot function, analyze without --whole-app still lists bridge type (napi vs wasm vs PyO3) so you do not pick a bridge that fights your deployment target (server vs browser vs embedded).
Quick start checklist
cargo install rust-anythingrust-anything setup(or install the Claude plugin after PATH is set)rust-anything profile . -- <your benchmark command>- Pick one unit;
bridge,record, let the agent fillport.rs,build,diff - Only after
gatepasses, enableshadow, then cut traffic inapp wire/lift
Star velocity alone does not prove production readiness — your cases.jsonl does.
Related reading
- Loop engineering for coding agents
- AWS Kiro PHP-to-Java parity engine
- External sandboxes for coding agents
- Claude Code commands reference
- What is MCP?
- imozuru deep-source skill
CLI flags and language preview status follow the GitHub README as of November 18, 2026.
