Developer uses Fable AI to rewrite 65k lines of Go to Rust for $400
A programmer shares a technique for using LLM-powered code transformation to port a large codebase between languages at a fraction of traditional costs.
What to know
- A developer rewrote 65,000 lines of Go to Rust using Fable AI for $400—claimed to be dramatically cheaper than manual porting (Bun's comparable project cost $165,000).
- The method treats code as an intermediate data representation (graphs, state machines, flowcharts), manipulates the structure, then converts back to the target language.
- Commenters note the technique is sound but warn that intermediate translation can miss 'load bearing' bugs and that idiomatic conventions don't always port cleanly across languages.
The dispute Whether the AI translation method is reliable enough for production code, or whether it introduces risk by losing domain-specific bugs and language idioms. · positions read across 67 posts and comments
The technique is sound and offers real value as a tool for certain rewriting tasks.
-
“fable's a very capable model when it comes to transforming concepts in and out of structural descriptions, and you can use it (along with a test suite I presume) to transpile a codebase. I wouldn't have thought to do this, but I think it…”
vessenes · Hacker News
Intermediate translation risks losing bugs and idiomatic code patterns; direct porting is safer in most cases.
-
“I'd highly recommend a direct "port" in most cases tbh, as many bugs are "load bearing" and may not survive the intermediate translation. I speak from experience.”
drzaiusx11 · Hacker News
The article's title is misleading clickbait that oversells what was actually accomplished.
-
“The title is the worst part of the essay…De clickbait your title though or you'll keep getting clickbait rage responses”
vessenes · Hacker News
The record 2 articles and posts · last 27 days
What people are saying 24 voices from 1 site · best of 67 · verbatim
- How thoroughly was the resulting Rust code tested, and were there hidden bugs that wouldn't have existed in the original?
- Does this method work for codebases with complex runtime behavior, or only for structural/algorithmic code?
- Sep 2
-
> I have rewritten several things from eg. Python to Rust, Rust to Go very recently.What is the scale? Because I'm pretty sure it's impossible to one shot 65k LoC with "good luck, make no mistakes" prompt.I also did this within a subscription. I counted the number of tokens afterwards and calculated the cost as if I'm paying per token. $400 is of…
-
>files might divergeThe way rune works with files minimizes chances of silent corruption. I keep original byte blobs immutable, separately there is a journal (kinda WAL) of positional deltas (inserts and deletes).So I only need to validate that blob + deltas = snapshot.Disk IO is encapsulated through VFS, and writes are atomics (write to a temp…
-
I have rewritten several things from eg. Python to Rust, Rust to Go very recently. The 400 USD is pretty arbitrary as you could rewrite several big projects pretty comfortably with the Claude ~100 USD subscription tier.In my experience it mostly comes down to the harness (or lack of) that you use. Something like 'superpowers' can be pretty verbose…
-
The ttyd and playwright is a clever differential way, personally I’m doing the same when it’s about to compare the views (or fix something related to rendering). Good job on that!A TUI editor’s real output is the bytes stored on disk, while rendering can look identical the saved files might diverge (encoding, line endings, trailing new lines etc)…
-
Thanks for the feedback. My main goal was to present the idea with an intermediate representation, I didn't payed much attention to the specifics of this translation, it would vary wildly depending on code bases.65k LoC of Go without comments resulted in roughly 60k LoC of Rust witout comments (code column of the cloc tool).The error handling is…
-
Most important information is missing here. * How many lines was the result? Considering how much err != nil and line splitting needs to be done in Go, did you at least reach 30k SLoC? * How was sloc counted here? includes comments, blank lines or not? (something like cloc will give a good answer). * Performance characteristics of resulting rust…
-
I recently rewrote a complex C++ program into Rust using the Strangler Mode, all codes are written by AI. Firstly, I split the code into some dynamic libraries, which uses C ABI to interacts with each other. Secondly, rewrite the libraries one by one. A init_xxx function are used to construct a object and a free_xxx is used to deconstruct it. A…
-
> if you just let it rip on the problem for hoursIn my experience, you can get good results if Fable does't write code itself, only spawn subagents.I can run Fable for 10 hours, and it would output 50k tokens and read 300k (30% of the context window). The resulting code is okay-ish. I would rarely merge LLM-produced code first try without an…
-
Fable is good at instruction following, so just adding the snippet I mentioned in the post is good enough for the most cases.There is a way to control tool invocations at the harness level when writing skills or agents.Example: ~/.claude/agents/critic.md --- name: critic description: > Plan Critic. Reviews an implementation plan. Use before the…
-
>feed the same input to the old Go app and the new Rust then diff the outputs.Yes, I completely forgot to mention, this is exactly my case. Rune is a TUI editor, so I feeded the same terminal sequences to the old and new apps.It didn't translate 1:1 (I ported core editor first, there were side panels, and different chrome elements) so I instructed…
-
I don't remember the details, roughly it was unexpected invocation of move semantic, causing use after free in a loop.My all-time favourite example is (again, my memory, I may be a bit wrong): for (int i = 0; i < (size_t)limit; ++i) { } at some point limit could potentially become greater than INT_MAX, the compiler decided that i<limit could never…
-
My understanding is, direct port is more expensive besides toy projects of course, looking at Bun and also listening to people who've done a few language conversions, they extract something first.If not an intermediate representation, my first question would be: how to split the work. You cannot just prompt full rewrite of 60K LoC, you cannot do…
- Sep 1
-
This is impressive but it again led me to questions. Porting the fuzzer from Go to Rust to validate Rust is a bit circular, isn’t it^^? Porting a fuzzer bug will hide the same class bug in the code it’s checking, who fuzzes the fuzzer / setup / harness:)? A good standard for rewrites is a differential testing, feed the same input to the old Go app…
-
I doubt that it is possible with GLM.I haven't played with GLM 5.3, only with 5.2, so I cannot say for sure.GLM is at the level of Opus. Fable is something different entirely. It is capable of tracing the data flows of the app, I even tried it in a huge PHP codebase, it works.PHP is a weird beast because it allows something like $v = 'SomeClass' +…
-
I recently performed this exact exercise of converting a complex library set from one language into an intermediate state machine representation and then translated into N other languages. It worked well but there's a lot of caveats. I'd highly recommend a direct "port" in most cases tbh, as many bugs are "load bearing" and may not survive the…
-
honestly it is hard to believe that seeing your replies and this heading: "The secret sauce".Giving the benefit of doubt, we all might be writing a bit like claude nowadays.If that is the case, I'd recommend reviewing the content before publishing to see if it sounds like a LLM.Or if you are trying to create "better" AI slop and think that is…
-
You are correct, that this is not the best Rust learning material.$400 are subsidized into the subscription, and this was mainly an experiment to prove the theory about data conversion step. I call it a success and I use rune editor daily.To me, running multiple agents is not very different from managing multiple teams — I won't be able to keep up…
-
The title is the worst part of the essay. Which is super interesting, to wit: fable's a very capable model when it comes to transforming concepts in and out of structural descriptions, and you can use it (along with a test suite I presume) to transpile a codebase. I wouldn't have thought to do this, but I think it makes sense, and I like it - it's…
-
I found this part to be interesting/clever:1. Extract the data representationAsk the LLM to represent your code as any combination of: graphs ontologies hierarchical state machines UML process charts constraints math formulae 2 Operate on the representations3 Convert representations back to code
-
Porting something to a language you don't know doesn't seem very helpful to me. You've locked yourself out of doing useful work except with continued application of more AI. Without the ability to verify it, except with even more AI maybe, you're starting on a slippy slope to slop.If the experiment was "spend 400 bucks to see if it'll work" then…
-
Human-written. I was trying to be short and straight to the point.LLM-powered rewrites and huge refactors are better done using 1 additional step "convert the code to <something> that represents it best".The simplest example is, for a CRUD app it can be swagger description. The more complex behaviour exhibit the app, the more raw information…
-
I realized that I haven't answered the question. These $400 also include the tests. Fable ported "human fuzzing session" (the best bug hunter) from Go to Rust and used it to validate everything else. I used hierarchical state machines, so a lot of my QA gates were encoded into the implementation — impossible states are, well, impossible.(I ported…
-
All very good questions.Agents are actively destroy QA gates in many ways, usually by cheating ("the test is buggy, not my changes" — changes the test), or just rot QA slowly by writing buggy overcomplicated testsWhat works for me 10/10 is fuzzing and my own constant usage. For this project specifically (text editor), I asked LLM to create…
-
How much did the verification cost on top? how did you gate it? was it a Go test suite you ran against the Rust or what? I always wonder how ppl are testing these rewrites, rewriting the tests can also lead to bug. I really wonder how reliable are rewrites like that, a 65k lines you didn't actually read. How did you confirm the semantic…