Find AI-introduced duplicate logic before refactoring with Slopo
Slopo is an open-source CLI that uses embeddings to surface non-exact duplicate code across distant parts of a repository, giving developers and coding agents a focused review list before refactoring.
What you get from it
What it does
Slopo scans a codebase for similar code that is not an exact copy. It indexes code units, calculates embeddings, clusters similar snippets, and ranks them by similarity and distance in the repository so distant duplicate logic is easier to spot.
This is useful when AI-assisted development has added new implementations of logic that already exists elsewhere. Exact copy-paste detectors can miss that pattern, and a coding agent often cannot keep the full repository in context while editing one area.
How to try it
Install it with uv tool install slopo, then initialize a config and run the three-step workflow:
slopo init
slopo index
slopo embed
slopo analyze
The generated report is meant for review, not blind automation. Start by excluding noisy paths such as tests, tune thresholds if the first result set is too large, and ask an agent to inspect one cluster at a time before deciding whether to refactor or ignore it.
Best use cases
- Auditing a repository after several AI coding sessions.
- Finding duplicate business logic spread across modules.
- Preparing a safer refactor backlog for a human or coding agent.
- Keeping an ignore file for reviewed false positives so new similar clusters stand out later.
Caveats
Slopo depends on embedding models through an external provider, so teams should review cost, privacy, and provider choice before running it on sensitive code. Similarity is also not proof of harmful duplication; every cluster still needs engineering judgment.
The project is young, but the workflow is practical: generate a narrow report, verify the clusters, then refactor only the duplicates that are real and worth the risk.
Source links
- GitHub repository: https://github.com/rafal-qa/slopo
- Official project page: https://slopo.dev/
- Hacker News Show HN thread: https://news.ycombinator.com/item?id=48762038
Discussion
Share practical experience, questions, or warnings with the community.
Sign in to join the discussion and vote on comments.
Sign in