I've been working on Claktor ever since I got frustrated with some 'code smells' AI Agents have been producing while writing Rust. Claktor is a refactoring tool that leverages custom AST parsing and processing to produce ranked 'leads' on what in the codebase should be looked into to reduce logic duplication. When I started out, it was mostly an opinionated 'how code should be written' detector, after attempting to formalize something objectively useful out of it I've arrived to this.
How is it scored? When exploring how to try to roughly judge how much logic there is in a program, the first approach is LOC. However that is just a proxy as lines can have lots of meat and can be gamed. What we arrived to are 'normalized tokens' which is a parsing of a normalized program by an LLM tokenizer. This neatly fits into then cost of reading the modified file by AI Agents. The more normalized tokens we reduce while preserving behaviour, the more deduplicated to codebase is and cheaper it is to read, extend, test and maintain by AI Agents. (the normalization is subject to some guards like: removing types does not reduce tokens)
Is this developed to the extent that it can be? By all means no! It already is very effective however as it greedily ranks everything through the codebase so AI Agents can remove around 3 to 10 times more for the same cost depending on the repo.
Please try it out and let me know how it goes! Currently works with TS,JS,Rust and Python
Comments URL: https://news.ycombinator.com/item?id=50517415
Points: 1
# Comments: 0


