Rust-split
save your tokens on large Rust source files
Get picks like this daily. Today's launch numbers, the top launches, AI and tech news, and a daily opportunity pick, straight to your inbox.
Want to reach these readers? Sponsor an issue.
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
HN · launched Sep 12, 2026 · 5 upvotes (top 87%) · 0 views
Niche: developer command-line tools · 226 launches, 3 in the last 7 days ▼ -80% · Explore this niche →
Category and tags
- Horizontal
- Dev tools
- Developer
- AI feature
- Hobby / open-source project
More like this: all 226 launches in developer command-line tools →
Could you build this?
Yes A CLI tool that parses Rust source files using `syn` or `tree-sitter` and splits modules/functions across multiple files is well within AI coding assistant capabilities.
Discussion
2 comments analyzed.
Competitors
Other products that read as similar to this one : 239 launches clear the similarity bar, closest 8 shown.
Attention rank: #204 of 240 (itself plus its competitors, highest first, normalized so YC and Product Hunt are compared fairly).
Launched 315 days after the earliest competitor.
- Tilth · hn · 2026-02-09 · 10 upvotes · similarity 0.48
- Token compression CLI to save Codex/Astra costs · hn · 2026-09-30 · 11 upvotes · similarity 0.43
- Optimizing LiteLLM with Rust · hn · 2025-11-18 · 27 upvotes · similarity 0.42
- Find overlapping Rust tests with mutation testing · hn · 2026-10-25 · 5 upvotes · similarity 0.42
- Ctx, save tokens by loading only the relevant tools · hn · 2026-06-16 · 8 upvotes · similarity 0.42
- Keep large tool output out of LLM context: 3x accuracy 95% fewer tokens · hn · 2026-03-05 · 10 upvotes · similarity 0.42
- I built an open-source Rust/TS AI agent runtime with a Next.js-style DX · hn · 2025-12-02 · 5 upvotes · similarity 0.41
- Learning Rust by writing a Markdown to HTML compiler · hn · 2026-07-29 · 25 upvotes · similarity 0.41
The niche, labels, vibe code rating and competitor comparison on this page are analysis by Nicheloom. If you use them, please credit nicheloom.com. How you may use our data.