LogoAIRosetta

Rust Anything: Progressive Rust Rewrite Tool Driven by Behavioral Verification

GitHub

Summaryrust-anything is an open-source toolchain initiated by erKam Yaman that treats the original program's runtime behavior as the "gold standard". It records and replays executions to verify each migration fragment, enabling reversible, module-by-module Rust migration with multi-language and AI-agent support, while acknowledging limits such as FFI overhead, coverage and complex state transitions.

In the GitHub open‑source community, a project called rust‑anything rose to prominence at the end of November 2026, becoming GitHub's Star of the Day and Star of the Week. The project was created and is maintained by Turkish developer erKam Yaman (GitHub user erkamyaman); the repository is available at github.com/erkamyaman/rust‑anything. In just a few weeks its star count climbed from the low hundreds to over 11,000 and it attracted dozens of contributors. It is not a simple code translator but a CLI toolset and MCP service built around "behavioral consistency verification," designed to help developers or AI programming agents migrate existing applications to Rust incrementally and controllably while ensuring the migrated behavior exactly matches the original.

,

Project positioning and design principles

Traditional rewrites carry large risks: insufficient test coverage, implicit dependencies, edge cases and side effects that are hard to exhaust, which can result in "it runs but behavior drifts." The core idea of rust‑anything is to turn the running original program itself into the specification. It records the original program's actual outputs under real and generated inputs (return values, exceptions, prints, side effects, etc.), and uses those records as the "gold standard" to replay and verify each Rust port on a per‑test‑case basis. A port is only enabled if all recorded cases match and it passes additional static checks (fmt, clippy, cargo test, unsafe audits, etc.). The ultimate goal is to progressively replace components to arrive at a pure Rust implementation while the original program remains available as a rollback and reference throughout the migration.

This design embodies the Strangler Fig pattern for cross‑language migration: replacing modules incrementally instead of a big‑bang rewrite, ensuring the system remains runnable and verifiable at all times.

Workflow and main capabilities

The tool provides a complete command set covering the full pipeline from analysis to deployment:

  1. Analysis and profiling: analyze generates migration priority reports; profile finds hot functions or modules under real workloads.
  2. Behavior recording: record runs the original program (supports generating edge cases, extracting calls from existing test suites, fixing clock and randomness, etc.), saving each call's inputs, outputs and side effects (such as HTTP requests, SMTP emails, and database changes).
  3. Building bridges: bridge auto‑generates Rust crates and adapter layers (using FFI mechanisms like napi‑rs, PyO3, etc., depending on the language) so the original code can call Rust implementations without modification.
  4. Implementation and verification: developers or AI agents implement logic in src/port.rs; diff replays all recorded cases; gate acts as the "completion definition," checking match rates, code quality and guarding against cheating (for example directly copying recorded outputs).
  5. Enablement and rollout: enable switches calls to Rust; for application‑wide migration, app front-door, app wire, app replay and app lift progressively migrate entry points and routing until the original language dependency can be removed.

Supported languages are broad: TypeScript/JavaScript, Python, Go, Ruby, Java, C, C#, PHP, Kotlin, PowerShell, and more. Some have been validated end‑to‑end in real open‑source projects (for example parts of Prettier, ESLint, json‑server, portions of CPython, and Go standard library path handling).

The project also deeply integrates AI programming agents: a one‑command setup configures an MCP server and skills for agents like Claude Code, Codex and Cursor, allowing agents to call analysis, recording and verification commands directly and forming a "agent writes code + tools act as the judge" loop.

Practical results and representative cases

Public case reports show clear benefits:

  • Prettier Rust port: approximately 19x speedup on large file sets, with the vast majority of cases fully matching.
  • ESLint: all recorded cases matched, single‑file processing about 25x faster.
  • json‑server: idle memory reduced from about 74MB to about 3.5MB.

The project candidly notes limitations: FFI overhead for very small functions called once can exceed the original language's JIT; therefore it emphasizes using profile and bench to identify hotspots worth migrating rather than blind wholesale translation.

Community response and technical value

rust‑anything's rapid rise reflects real pain points in software engineering: many teams want Rust's memory safety and performance but the cost and risk of rewrites are high; AI agents can write code better than before but lack robust correctness guards. This project fills the gap of an intermediate layer for "AI generation + behavioral verification."

It is not a silver bullet. Complex state machines, highly concurrent systems, or ecosystems reliant on dynamic reflection may still be challenging; recording coverage depends on input generation quality; migrating very large monoliths requires human planning. Documentation and the status page (docs/STATUS.md) clearly indicate maturity levels, distinguishing languages "validated in real code" from those "validated only in test fixtures."

From an open‑source perspective, rust‑anything is offered under MIT/Apache dual licensing, the documentation site (rustanything.ai) provides multilingual support, and community contributions are encouraged. The author also offers commercial consulting for more complex migrations.

Conclusion

rust‑anything represents a pragmatic migration methodology: it does not promise magical automatic translation but puts verification first, treats behavior as the specification, and makes replacement a reversible, incremental process. For teams that want to introduce Rust's performance and safety without interrupting business operations, and for developers exploring AI‑assisted rewrites, it provides a practical toolchain and engineering discipline. Interested readers can visit the GitHub repository or official documentation to run small‑scale pilot validations on their projects.

▶️ Enjoyed this article? Creating content is hard!

Follow our YouTube channel:
AI Rosetta

Your likes, subscriptions and shares are our biggest support! 🙏

For more AI news visit: https://www.airosetta.com

CopyrightStatement

Comment

Please login before commenting

NoComments

RelatedNews

LoadingMore

Rust Anything: Progressive Rust Rewrite Tool Driven by Behavioral Verification - Airosetta News