rafal-qa/slopo

Embedding-based code duplication detector

What it solves

Slopo is a CLI tool designed to find non-exact code duplication across a codebase. While standard tools easily find identical copy-pasted code, Slopo targets "similar" code—snippets that are written similarly but are not identical, and are often spread far apart across different modules or large files, making them difficult for humans or traditional tools to detect.

How it works

Slopo uses embedding models to represent code units as vectors. It calculates an embedding for every code unit and identifies pairs with high cosine similarity. These similar units are grouped into clusters, which are then reranked based on their similarity and their distance within the codebase (applying a boost for units that are further apart). The resulting clusters are presented in a report, which can then be reviewed by an AI coding agent to confirm if they are actual duplicates that require refactoring.

Who it’s for

Developers and teams looking to reduce technical debt by identifying and refactoring redundant, similar code across large projects in multiple supported languages (including Python, TypeScript, JavaScript, Java, Kotlin, C#, Go, Rust, PHP, and Elixir).

Highlights

  • Embedding-based detection: Uses ML models (via Jina AI, Voyage AI, or local Ollama models) to find semantic similarity rather than exact text matches.
  • Incremental re-indexing: Updates the index with only changed files to save time and resources.
  • AI-agent ready: Generates reports specifically designed to be filtered and processed by AI coding agents.
  • Flexible configuration: Supports a wide range of embedding providers via LiteLLM and allows tuning of similarity and complexity thresholds.

Related

  • Dispatch
  • Dispatch
  • Project
  • Project
  • Project