Slopo finds similar code duplicates for AI refactoring

Slopo finds similar code duplicates for AI refactoring

Slopo is a CLI tool that finds code that looks similar but is not an exact copy. It targets the kind of duplication that is easy to miss because the code may sit in different folders or far apart inside a large file. It supports Python, , JavaScript, Java, Kotlin, C#, Go, Rust.

Slopo turns each code unit into an embedding, then looks for units whose are close to each other. It reports clusters of similar code, ranked by and by distance in the codebase. The intended workflow is to give those clusters to an , let it reject false matches, then use the remaining clusters as work.

Setup uses `uv tool install slopo`, `slopo init`, then `slopo index`, `slopo embed`, and `slopo analyze`. come from an external provider through LiteLLM, with Voyage AI mentioned as a code-focused option, and reviewed clusters can be stored in `slopo.ignore.txt` so they do not keep returning in later reports.

Key points

  • It looks for similar code, not only exact copy-paste duplicates.
  • It supports eight common languages, including Python, , JavaScript, Java, Go, and Rust.
  • The main commands are `slopo index`, `slopo embed`, and `slopo analyze`.
  • The report groups similar code into clusters for an to review.
  • Reviewed false matches can be saved in `slopo.ignore.txt`.
Read original