Show HN: CLI tool for detecting non-exact code duplication with embedding models
TL;DR Highlight
Embeddings cluster similar logic across a codebase and hand it to agents for review
Who Should Read
Backend developer on a large codebase whose AI agents keep reimplementing logic that already exists
Core Mechanics
- Embeddings find duplicate code
- Code snippets whose embeddings (numeric vectors of meaning) are close become duplicate candidates.
- It aims to catch the same logic written differently, not just copy-paste.
- It targets what agents miss
- Agents only see the code they are working on plus what references and names surface.
- In large messy codebases they miss an existing solution and reimplement it.
- Distant code ranks higher
- A boost of up to 15% is given by directory hops, or up to 10% by line distance within one file.
- Output is clusters ranked by similarity and distance.
- Two modes
- slopo review compares Git changes against the rest of the code.
- slopo analyze scans the whole indexed codebase.
- Cost and precision claims
- Embedding API access costs practically nothing compared with agent models.
- An agent given a ready duplicate report spends fewer tokens and loads only relevant context.
- The author admits false positives
- It may report much similar code that is not a duplicate.
- For exact copies, deterministic tools are said to fit better.
Community Reactions
- Author says results vary widely
- Results differ a lot by codebase.
- Sometimes most hits are false positives, with the rest being strong refactor candidates or bugs.
- A commenter built something similar
- They ran it in code review on a large monorepo, showing similar snippets.
- They also saw it useful for common constructs and spotting code copied from open source.
- Commenters asked for comparisons
- Comments asked about jscpd, semhash and BM25.
- One suggested a deterministic tier before the embedding pass for efficiency.
- Usage ideas and concerns
- One suggested a pre-push hook to keep code clean.
- Another suggested running generated tests in isolation to check false positives.
How to Apply
- Run review on a small repo with Jina
- Run uv tool install slopo, then slopo init to create the config.
- Set jina_ai/jina-code-embeddings-0.5b, 256 dims, task code2code.query, then run slopo index, embed, review.
- Let the agent filter the report
- Export skills with slopo agent-configs and copy them into .claude/skills.
- Run /slopo-review in Claude Code to discard noise quickly.
- Run ignore before full analysis review
- Run slopo analyze, then slopo-analyze-ignore to drop obvious noise.
- Decide the remaining clusters one at a time with slopo-analyze-one.
- Share slopo.ignore.txt with the team
- Add cluster hashes to it and commit it to Git.
- Refresh it periodically since hashes change when code changes or moves.
Try It
# Run in a terminal (project root, uv required)
uv tool install slopo
slopo init
# Fill source_dir and the model settings below in the generated slopo.conf.yaml
# embedding_model: jina_ai/jina-code-embeddings-0.5b
# embedding_dimensions: 256
# embedding_params:
# task: code2code.query
export SLOPO_EMBEDDING_API_KEY={{Jina_API_key}}
slopo show-config
slopo index
slopo embed
slopo review --base HEAD~1Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques