Ru

Rust-split – save your tokens on large Rust source files

Hacker News

Rust-split – save your tokens on large Rust source files

A common failure mode for AI SW development is that agents tend to build large "God" files. This is bad on your token burn. A) because the larger your source file the more churn the LLM takes to find and emit edits, which are more likely to fail, and B) the real kicker - the agent's process is to move one item at a time, which is an O(n^2) algorithm, but especially bad because it inevitably breaks and the code mushes up and sadness ensues (burning time and tokens). So, I have had lots of success with rust-split and a few skill notes. rust-split uses the AST (syn) to find the correct boundaries. Two passes: explode cuts the file into top-level items with their comments and #[attrs] attached - lossless, cat the chunks together and you get the original back byte for byte, so you can check it before trusting it - then split writes the module layout under a LOC ceiling. What's left for the LLM is basically fixing imports, which doesn't burn anywhere near as many tokens. It's not perfect with the transition but fixing small import issues LLMs can do efficiently. rust-split is released as a GitHub attested release or a crates.io install: https://github.com/owebeeone/rust-split cargo install rust-split Be sure to add the skill file ( https://github.com/owebeeone/rust-split/blob/main/skills/rus... ) and set your project's line thresholds. I chose a soft limit of 1000 LOC to trigger the decision to split (I've found that at 2000 LOC agents lose it, so give yourself a safety margin) and the target max size of a split file to be 500 LOC, but preferably more smaller files than 2x500 LOC files. Enjoy

Share card

Actual performance

5points
2comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: agents, agent, notes · Missing: mac, macos, cursor
75%75% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Strong signals: efficiently · Missing: supports, reddit linkedin, podcasting
74%74% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: 000, io · Missing: https docs, excited, just released
49%49% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
43%43% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: efficient · Missing: plus, platform, intuitive
20%20% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: margin · Missing: arr, mrr, revenue
19%19% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

St
StatsD in Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

StatsD in Rust

Hacker News1
TF
TF-IDF in Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TF-IDF in Rust

Hacker News1
Ru
Rust FFI in a Wireshark C dissector51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Rust FFI in a Wireshark C dissector

Hacker News1
Ru
Rust-wasm-webpack50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Rust-wasm-webpack

Hacker News6
Ri
Risp – Lisp in Rust68%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Risp – Lisp in Rust

Hacker News314
Cl
Classical Ciphers in Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Classical Ciphers in Rust

Hacker News2
A
A Sorted Array in Rust with O(√N) Inserts/Deletes53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Sorted Array in Rust with O(√N) Inserts/Deletes

Hacker News1
Sc
Screencast: An Introduction to Rust57%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Screencast: An Introduction to Rust

Hacker News3
Ha
Handlebars for Rust51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Handlebars for Rust

Hacker News2
Ox
Oxischeme – A Scheme implementation in Rust56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Oxischeme – A Scheme implementation in Rust

Hacker News18