slopo
Open-source CLI tool that uses embedding models to detect non-exact code duplication spread across a codebase, designed to catch the blind spots of AI coding agents.
At a Glance
About slopo
Slopo is a lightweight, open-source command-line tool built to surface the kind of code duplication that AI agents and traditional tools routinely miss: semantically similar functions written differently and scattered across distant parts of a codebase. It is written in Python, licensed under AGPL-3.0, and distributed via PyPI. The project was created by rafal-qa and reached its v0.3.0 release in July 2026.
What It Is
Slopo is an embedding-based code duplication detector. Rather than looking for exact copy-paste matches, it calculates embeddings for every code unit in a project, then identifies pairs whose embeddings are close enough to suggest they implement the same logic. The result is a set of ranked clusters — groups of similar code units — that serve as structured input for a developer or an AI coding agent to review and act on. It supports Python, TypeScript, JavaScript, Java, Kotlin, C#, Go, Rust, PHP, and Elixir.
The Problem It Solves
AI coding agents tend to re-implement logic that already exists elsewhere in a codebase rather than reusing it, because they cannot load an entire large codebase into context at once. The resulting duplication is not a copy of existing code — it is a new implementation of the same solution. This creates a compounding problem: the agent may later update one copy while others drift out of sync, and the growing inconsistency makes the agent less reliable when deciding where to add new logic. Slopo describes this as "the blind spot" — distant functions doing the same thing in a different form that neither humans nor AI agents catch easily.
How Detection Works
The analysis pipeline runs in three steps:
slopo index— parses source files and extracts code units using AST analysis, filtering by a configurable complexity threshold (body_node_count_threshold) to exclude trivially small snippets.slopo embed— sends code units to an external embedding provider (any LiteLLM-compatible model, with Voyage AI recommended for code) and stores vectors in a local SQLite database.slopo analyze— computes cosine similarity between all pairs, applies a distance-based reranking boost (up to 15% for cross-directory pairs, up to 10% for same-file distance), and writes a Markdown report with clusters ranked by priority.
Exact-copy duplicates are also reported but handled separately: the report shows the code once and lists every path where it appears, rather than repeating identical snippets.
Workflow with AI Agents
Slopo is explicitly designed to be used alongside an AI coding agent in a two-phase workflow. In the first phase, the agent reviews each cluster in the generated report and adds non-duplicate cluster hashes to a slopo.ignore.txt file. In the second phase, the agent analyzes the remaining confirmed duplicates, assesses scope and refactoring risk, and performs the actual consolidation. The ignore file can be committed to a Git repository and shared across a team; new or modified clusters reappear automatically in subsequent runs.
Update: v0.3.0
The latest release is v0.3.0, published on July 3, 2026. The repository was created in June 2026 and has seen active development since, with the project moving from v0.2.0 (used in the example report bundled in the docs) to v0.3.0 within weeks. The GitHub repository had 204 stars and 4 forks as of early July 2026, signaling early community interest in the tool's niche focus on AI-assisted development workflows.
Community Discussions
Be the first to start a conversation about slopo
Share your experience with slopo, ask questions, or help others learn from your insights.
Pricing
Open Source
Free to use under the AGPL-3.0 license. Full source code available on GitHub.
- Embedding-based code duplication detection
- Support for 10+ programming languages
- LiteLLM-compatible embedding provider support
- Incremental re-indexing
- Cluster-based Markdown report output
Capabilities
Key Features
- Embedding-based non-exact code duplication detection
- AST-based code unit extraction with complexity thresholds
- Distance-aware reranking (cross-directory and same-file boosts)
- Exact-copy duplicate detection and reporting
- Incremental re-indexing for changed files only
- Cluster-based Markdown report output
- Ignore list (slopo.ignore.txt) for reviewed clusters
- LiteLLM-compatible embedding provider support
- Configurable similarity and rerank thresholds
- SQLite local database for embeddings and index
- Support for 10+ programming languages
- CLI commands: init, index, embed, analyze, show-config
