{"id":23656,"date":"2026-09-02T14:51:30","date_gmt":"2026-09-02T14:51:30","guid":{"rendered":"https:\/\/scannn.com\/i-used-fable-to-rewrite-65kloc-to-rust-it-cost-400\/"},"modified":"2026-09-02T14:51:30","modified_gmt":"2026-09-02T14:51:30","slug":"i-used-fable-to-rewrite-65kloc-to-rust-it-cost-400","status":"publish","type":"post","link":"https:\/\/scannn.com\/lv\/i-used-fable-to-rewrite-65kloc-to-rust-it-cost-400\/","title":{"rendered":"I used Fable to rewrite 65kLoC to Rust. It cost $400."},"content":{"rendered":"\n<div id=\"\">\n<p class=\"text-sm text-slate-600 dark:text-slate-400 !mt-0 !mb-0\"><time datetime=\"2026-09-01\">September 1, 2026<\/time> \u00b7 <!-- -->4<!-- --> <!-- -->min<\/p>\n<p><\/p>\n<p>I kept joking that I would have learned Rust a long time ago, but C++ money is not enough for a decent fursuit. Moreover, I&#8217;m bald, so I cannot simply dye my hair blue.<\/p>\n<p>But then two things happened at once.<\/p>\n<p>First, I tried the <code>\/teach<\/code> skill by Matt Pocock <sup><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" id=\"user-content-fnref-teach-skill\" data-footnote-ref=\"true\" aria-describedby=\"footnote-label\" href=\"#user-content-fn-teach-skill\">1<\/a><\/sup> to learn Rust, and it clicked: &#8220;Teach a C++ programmer idiomatic Rust, skip syntax and helloworld, only focus on main differences.&#8221;<br \/>\nThis skill is like a personal trainer \u2014 overcoming the pleasant challenge keeps me engaged, and at the same time, the material never gets overwhelming. I recommend trying it.<\/p>\n<p>Around the same time, I came across &#8220;Rewriting Bun in Rust&#8221; <sup><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" id=\"user-content-fnref-bun-rust\" data-footnote-ref=\"true\" aria-describedby=\"footnote-label\" href=\"#user-content-fn-bun-rust\">2<\/a><\/sup> and got curious about the method:<\/p>\n<blockquote>\n<p>Each dynamic workflow was a loop like this &#8211; a workflow for:<\/p>\n<ul>\n<li>Generate a porting guide mapping Zig patterns &amp; types to Rust patterns &amp; types<\/li>\n<li>Mechanically port every <code>.zig<\/code> file to a <code>.rs<\/code> file, matching the PORTING.md and LIFETIMES.tsv<\/li>\n<li>Fix every crate&#8217;s compiler errors<\/li>\n<li>Get subcommands like <code>bun test<\/code> or <code>bun build<\/code> to work<\/li>\n<li>Get every test in Bun&#8217;s entire test suite to pass<\/li>\n<li>Several large refactors and cleanup passes<\/li>\n<\/ul>\n<\/blockquote>\n<p>The cost of this project was 535496 lines for $165000.<\/p>\n<p>I had an idea that a rewrite could be done much cheaper using some intermediate representation.<\/p>\n<blockquote>\n<p>Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won&#8217;t usually need your flowcharts; they&#8217;ll be obvious. &#8212; Fred Brooks<\/p>\n<\/blockquote>\n<p>This applies to any LLM, but Fable 5 specifically traces the data flow with insane precision. If you can rephrase your problem as a data problem, it can autonomously do complex refactorings, rewrite from one language to another, extract or merge services \u2014 in other words, make fundamental changes.<\/p>\n<h3 id=\"the-three-steps\"><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" aria-hidden=\"true\" tabindex=\"-1\" href=\"#the-three-steps\"><span class=\"icon icon-link\"\/><\/a>The three steps<\/h3>\n<p>Ask the LLM to represent your code as any combination of:<\/p>\n<ul>\n<li>graphs<\/li>\n<li>ontologies<\/li>\n<li>hierarchical state machines<\/li>\n<li>UML process charts<\/li>\n<li>constraints<\/li>\n<li>math formulae<\/li>\n<\/ul>\n<h4 id=\"2-operate-on-the-representation\"><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" aria-hidden=\"true\" tabindex=\"-1\" href=\"#2-operate-on-the-representation\"><span class=\"icon icon-link\"\/><\/a>2. Operate on the representation<\/h4>\n<p>At this point, you can ask it to simplify the state machine by reducing the number of states, or to remove hidden channels of communication (e.g. via a shared table, or by sharing addresses in RAM).<\/p>\n<h4 id=\"3-put-the-representation-back-into-code\"><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" aria-hidden=\"true\" tabindex=\"-1\" href=\"#3-put-the-representation-back-into-code\"><span class=\"icon icon-link\"\/><\/a>3. Put the representation back into code<\/h4>\n<p>Now ask for the code \u2014 even in another programming language.<\/p>\n<h3 id=\"the-secret-sauce\"><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" aria-hidden=\"true\" tabindex=\"-1\" href=\"#the-secret-sauce\"><span class=\"icon icon-link\"\/><\/a>The secret sauce<\/h3>\n<blockquote>\n<p>For some time now, agents have excelled at tool use, and insofar as they are able to treat other agents as tool invocations. &#8212; a post by Anthropic <sup><a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" id=\"user-content-fnref-multiagent\" data-footnote-ref=\"true\" aria-describedby=\"footnote-label\" href=\"#user-content-fn-multiagent\">3<\/a><\/sup><\/p>\n<\/blockquote>\n<p>What it means on practice is, prohibit Fable read and write code, and instruct to orchestrate subagents instead. In that way Fable will spare its context window during tens-hours-long runs, and token cost will be also reasonable.<\/p>\n<p>You can add to Fable&#8217;s prompt:<\/p>\n<figure data-rehype-pretty-code-figure=\"\" class=\"not-prose relative group\">\n<pre style=\"--shiki-dark:#dbd7caee;--shiki-light:#393a34;--shiki-dark-bg:#121212;--shiki-light-bg:#ffffff\" tabindex=\"0\" data-language=\"markdown\" data-theme=\"vitesse-dark vitesse-light\"><code data-language=\"markdown\" data-theme=\"vitesse-dark vitesse-light\" style=\"display:grid\"><span data-line=\"\"><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">avoid extensive <\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Glob<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">\/<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Grep<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">\/<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">WebSearch<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">\/<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Bash<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\"> - use <\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Explore<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\"> agents instead<\/span><\/span>\n<span data-line=\"\"><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">avoid extensive <\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Edit<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">\/<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Bash<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\"> - use <\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">general-purpose<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\"> sonnet or haiku subagents instead<\/span><\/span>\n<span data-line=\"\"><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">use <\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\">Read<\/span><span style=\"--shiki-dark:#666666;--shiki-light:#999999\">`<\/span><span style=\"--shiki-dark:#DBD7CAEE;--shiki-light:#393A34\"> sparingly, to verify critical claims yourself<\/span><\/span><\/code><\/pre>\n<\/figure>\n<p><code>Glob<\/code>, <code>Grep<\/code>, and <code>WebSearch<\/code> are names of Claude Code&#8217;s built-in tools.<\/p>\n<p>I hope that helps. Happy coding.<\/p>\n<p>P.S. The 65kLoC is <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/aka-rider\/rune\" class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\">rune \u2014 a terminal editor for the LLM era<\/a>:<\/p>\n<ul>\n<li>Obsidian \u00d7 VSCode in your terminal, with <strong>\u2318 &#8211;<\/strong> keystrokes<\/li>\n<li>The main focus is markdown and syntax highlight; language servers and debuggers are for agents<!-- -->\n<ul>\n<li>Markdown tables<\/li>\n<li>Obsidian vaults, with <code>[[wikilinks]]<\/code><\/li>\n<li><code>- [x] buy the milk<\/code> tasks<\/li>\n<\/ul>\n<\/li>\n<li>Auto-merge, crash data recovery, and much more&#8230;<\/li>\n<\/ul>\n<p><span class=\"tracking-[0.5em] text-lg\">\u00b7\u00b7\u00b7<\/span><\/p>\n<p>Photo by <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/unsplash.com\/@laurar1vera\" class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\">Laura Rivera<\/a> on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/unsplash.com\/photos\/green-and-black-typewriter-on-green-table-9ZQzrLWV52M\" class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\">Unsplash<\/a><\/p>\n<p class=\"mt-12 text-sm text-slate-500 dark:text-slate-400\">Liked this? Grab the <a class=\"inline-flex items-center focus-visible:ring-primary-500 focus:outline-none focus-visible:rounded focus-visible:ring focus-visible:ring-offset-2 font-medium text-primary-500 hover:text-sky-600 active:text-primary-700 disabled:text-primary-200\" href=\"https:\/\/iurii.net\/en\/feed.xml\">RSS feed<\/a> to get notified.<\/p>\n<\/div>\n<p><a href=\"https:\/\/iurii.net\/en\/blog\/posts\/software-engineering\/i-used-fable-to-rewrite-65kloc-to-rust\/?utm_source=tldrdev\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>September 1, 2026 \u00b7 4 min I kept joking that I would have learned Rust a long time ago, but C++ money is not enough for a decent fursuit. Moreover, I&#8217;m bald, so I cannot simply dye my hair blue. But then two things happened at once. First, I tried the \/teach skill by Matt [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":23657,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[143],"tags":[],"class_list":["post-23656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/posts\/23656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/comments?post=23656"}],"version-history":[{"count":0,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/posts\/23656\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/media\/23657"}],"wp:attachment":[{"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/media?parent=23656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/categories?post=23656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scannn.com\/lv\/wp-json\/wp\/v2\/tags?post=23656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}