Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.
Proposal: new apps in Rust
Status: proposed. The first slice (CLI apps) is built in the same pull request.
rust-anything proves a port by the original's recorded behavior: the agent writes the Rust, and
diff and gate decide whether it is done. This proposal brings the same idea to software that
has no original yet. The agent still writes the code; what decides is a spec the user approved,
checked by a command, never the agent's own word.
What craft-anything and REA do
Craft Anything studies a target, has a coding agent
build a new project, checks the build against the original and refines it. Its rebuild - builds
from a request alone ("A snake game in Rust"). REA is the
evidence engine: it inspects shipped software and returns observations, inferences and unknowns
for an agent to build from. What makes them good at building with agents:
| Concept | Where | What it does |
|---|---|---|
| One loop with named stages | craft-anything README, rebuild/mod.rs |
Study, Build, Check, Ready. Measured differences go back to the agent for up to max_rounds refinement rounds. |
| The agent's own check is the run's check | rebuild/self_check.rs |
While building, the agent calls rebuild_check, which runs exactly the checks the run applies after its turn (as round 0). The agent never grades itself with a different test. |
| Claims, counted | self_check.rs, kinds/runs.rs |
Each check yields claims ("exits like the original", "prints what it prints"), reported as "5 of 5 claims hold". |
| A self-test contract | kinds/self_test.rs |
A game must take --self-test <file.json>: play the core loop with scripted input, measure each step from its own state, save the results. A step it did not test fails as "not tested". |
| Unknowns, written down | rebuild/brief.rs, REA skill |
Every question the evidence does not answer is recorded with its severity and what would settle it, and is closed only with the evidence that settles it. "Missing evidence is never proof, so mark what you estimated." |
| Proof has a source | REA reconstruction coverage | Evidence is observed, derived or inferred. A passing verifier summary cannot promote an inference into an observation; open unknowns keep a claim unknown. |
| A question checklist | REA skill, "Plan broader investigations" | Turn the request into questions first; before finishing, mark each answered, partly answered or unresolved, and never call the work complete while one is open. |
| Stop instead of looping | brief.rs step 4, rebuild/mod.rs (progress.stalled()) |
When a check says another turn cannot fix a comparison, stop retrying, keep it unverified and say so. Rounds that make no progress end the build. |
| Keep a passing check | rebuild/kept_check.rs |
A round where every check passed stands while nothing it looks at changes (by digest). A round with a failure is never kept. |
| Your own project | kinds/own.rs |
With nothing to recreate, a project is judged by what it does for itself: its build, then its tests. |
| Notes mid-turn | rebuild/notes.rs |
What the person adds while the agent works reaches it at its next tool call through a hook, not after the whole turn. |
| A plan the person can follow | brief.rs step 2 |
3 to 7 steps in plain words, kept current, so the person sees what is left. |
| Rules for agents | craft-anything AGENTS.md, pitfalls | Never present partial or placeholder behavior as success; tests assert relations; every mistake becomes a rule. |
What fits rust-anything
rust-anything already has most of the machinery, for ports:
app replayruns any binary against trycmd case files (<name>.tomlwith arguments, stdin, exit code, and.stdout/.stderrbeside it) and reports where each first differs. It needs no original when given--build.gate's Rust checks: fmt, clippy with warnings as errors, tests,unsafewithSAFETYcomments.rules(corrections that reach every later agent), stall detection indiff, tamper detection forcases.jsonl.
What is missing is the oracle. For a port it is the original; for a new app it has to be the user. So the new mode is spec first, approved by the user, then frozen:
| Concept | Fits? | In rust-anything |
|---|---|---|
| Spec or oracle first | Yes, core | spec/cases/: examples of what the app does, written before the code. |
| Proof has a source | Yes, core | A case counts only once the user approved it (spec approve, a CLI step the MCP server does not offer). Drafts run and are reported, but never make the app done. An approved case edited later fails until approved again, and so does one whose fs.base input folder changed: its hash covers that folder's files. |
| The agent's check is the run's check | Yes | spec check is the only verdict, the same for the agent, the user and CI. |
| Claims, counted | Yes | "7 of 9 approved cases pass", with drafts and checks listed apart. |
| Unknowns, written down | Yes | ## Open questions in spec/SPEC.md as - [ ] items. An open one keeps the app from done. |
| Question checklist | Yes | The skill grills the user into SPEC.md before any code. |
| Stop instead of looping | Yes, reuse | Stall detection, as in diff: three changes to src/ in a row with no case gained. |
| Rules memory | Yes, reuse | rules writes spec/RULES.md in a new app. |
| Plan the person can follow | Yes | The skill keeps a short plan in plain words. |
| Self-test contract | Later | For apps whose output cannot be listed case by case (games, TUIs, GUIs). |
| Kept checks, notes mid-turn | No | Checks here take seconds, and the user talks to their own agent directly. |
The new mode
new ──> SPEC.md ──> draft cases ──> user approves ──> build ──> spec check ──> done
a crate what it does, examples the `spec approve`, you or every approved
and spec/ open questions agent writes user's step your agent case passes, gate's
Rust checks pass
A new project:
my-app/
Cargo.toml, src/main.rs a stub that fails every case until the app is written
spec/
SPEC.md what it does, what it does not, open questions
RULES.md corrections (`rules --add`)
approved.json a hash per approved case, written by `spec approve`
cases/ trycmd cases, the same format `app record` writes
rust-anything.json
add-two.toml add-two.stdout
Commands (first slice)
| Command | What it does |
|---|---|
rust-anything new <dir> [--name <bin>] |
Makes a binary crate with spec/: SPEC.md, an example case, and a main that fails every case. Refuses a folder that has files. |
rust-anything spec approve <dir> [--case <name>]... |
The user's step: lists the cases and records a hash of each (spec/approved.json). CLI only. |
rust-anything spec check <dir> [--case <name>] [--json] |
Builds, replays every case against the binary, runs fmt, clippy, tests and the unsafe audit, and says whether the app is done: every approved case passes, none changed since its approval, no open question, every Rust check passes. Otherwise it names the next step. |
app replay, rules |
Unchanged; they find spec/ in a new app. |
MCP: new and spec_check become tools; spec approve stays a terminal command so the approval
is the user's.
Skill
A new file, skills/rust-anything/new-app.md (also in plugin/ and directory/), linked from
SKILL.md like whole-app.md:
- Grill the user: what goes in, what comes out, errors, what is out of scope. Write SPEC.md; every unanswered question goes under Open questions.
- Draft cases in
spec/cases/from the user's own examples first, then edges (empty input, non-ASCII, bad arguments). Show them; the user runsspec approve. - Write the app. Run
spec checkafter each change; it is the only verdict. - A failing approved case means the code is wrong. If the user says the case is wrong, they change and approve it again. Never edit an approved case to make it pass.
- When
spec checksays stalled, stop and show the user what still fails. - Corrections become rules (
rules --add).
Later slices
- Libraries:
new --lib, cases as{"fn", "args", "returns" | "throws"}lines run through a generated test that calls the crate's public functions. - Servers:
new --http, reusing the HTTP case format andapp replay's server support. - A reference program as the oracle:
spec record -- <command>runs a program the user trusts (a prototype, a similar tool) and writes its answers as drafts for the user to approve. - Properties: invariants (
decode(encode(x)) == x) checked on fuzzed inputs. - A self-test contract for games, TUIs and GUIs, as in craft-anything.
- A README section (with every translation) and an MCP prompt once 1 and 2 land.
Done means
For the first slice:
new,spec approveandspec checkexist;newandspec_checkare MCP tools anddocs/tools.mdlists them.- Tests: a new app's draft case is not counted, and once approved it fails (0 of 1) until the app
is written; then
spec checkpasses. Editing or deleting an approved case, a passing case nobody approved, and an open question each fail it; a folder with files refusesnew. - The skill file is in
skills/,plugin/anddirectory/, identical, andtests/skill.rsaccepts every command it names. docs/STATUS.mdandCHANGELOG.mdsay what works and how it was checked.