Rewriting Code With AI A developer used AI agents Gemma 4 12B and Qwen 3.6 35B to rewrite Rust code without doc-comments, but found direct rewriting unreliable. Instead, the developer had Qwen 3.6 generate a Python script that successfully rewrote 43 Rust files, missing only about 20 multi-line function cases, concluding that using an LLM to write a script is more reliable and faster than direct code rewriting. It has become trendy to rewrite code using AI agents . In my ongoing quest to become more trendy myself, I decided to try to fix a nagging issue in my Rust code base. I had written the Rust code without doc-comments; for some reason I just used inline comments instead. I tried to use Gemma 4 12B and Qwen 3.6 35B to rewrite the code directly . With recent changes in llama-cpp , this worked fairly well, but files were too large and the AI agents made mistakes. Eventually, I changed my approach. • I had Qwen 3.6 generate a Python script that would perform all the rewrites. • The script, as Qwen 3.6 wrote it, used line-by-line parsing of Rust files to move comments and edit them. • The script worked correctly on all 43 Rust files, although it missed about 20 multi-line function cases. This task made me realize that using an LLM to rewrite code directly is not always the best approach. Instead, it might be better to have the LLM write a Python script that rewrites code files. This may be more reliable, and much faster.