Clean up the duplicate code in your repo, and stop your coding agents from writing more.
Deslop finds duplicate code across a codebase and ranks it worst first, so the cleanup that matters most comes first. While you or Claude Code, Cursor or GitHub Copilot edit, it flags new code that copies something that already exists. It is an open-source alternative to jscpd that also runs live in the editor and inside the agent loop.
Install for VS Code · Add to GitHub Actions · Supported languages · Documentation
- VS Code: install from the Marketplace and open your repo. Top Offenders lists the clusters to remove, and each copy can be diffed against the canonical one before you refactor.
- JetBrains: install the plugin zip from the latest release from disk, with LSP4IJ. It is not on the JetBrains Marketplace yet.
- CLI:
brew install nimblesite/tap/deslop, or on Windowsscoop bucket add nimblesite https://github.com/Nimblesite/scoop-bucketthenscoop install deslop. Without Homebrew on macOS or Linux, runinstall.sh:curl -fsSL https://raw.githubusercontent.com/Nimblesite/Deslop/main/install.sh | bash.
deslop # scan the current directory
deslop . --output ./report # write report.json, report.txt, report.htmlConfiguration lives in .deslop.toml (reference).
Coding agents. The VS Code extension bundles deslop-mcp. Point your agent at it, then add the Deslop agent instruction to your repo so the agent calls find-similar before writing a function, helper or test setup. Setup for each client: AI integration.
CI. Fail the build when duplication goes over a ceiling:
- uses: actions/checkout@v4
- uses: Nimblesite/Deslop@vX.Y.Z # the newest release tag
with:
fail-over: "5.0" # fail above 5% duplicated linesAnywhere else, run deslop . --fail-over 5.0. It exits with code 3 when the ceiling is breached and still writes the reports. For pre-commit or prek, install the CLI and add:
repos:
- repo: https://github.com/Nimblesite/Deslop
rev: vX.Y.Z
hooks:
- id: deslop
args: ["--fail-over", "5.0"]Deslop parses code with tree-sitter and compares syntax trees, not token streams. That lets it report copies with renamed identifiers, changed literals or inserted statements as well as exact ones. Optional local embeddings through Ollama add copies that behave the same but read differently.
Accuracy is checked against judged clone registers: pairs from pinned open-source repositories that a reviewer has marked as real copies or not copies. Accuracy Transparency explains the scoring. No head-to-head benchmark against jscpd or other detectors has been published, so we make no claim that Deslop is more accurate than they are.
The engine is a Rust workspace under crates/. The VS Code client is in clients/vscode/ and the JetBrains client in clients/jetbrains/.
make ci # build, lint and test everything, as CI does
make test # fail-fast tests with coverage thresholds
make lint # format and static analysis- Accuracy outranks features, languages, UI and performance. Read AGENTS.md before changing detection code.
- Specs live in docs/specs/ and the code map in docs/repo-index.md.
- The most useful contribution is a bug report with a reproduction, especially for inaccurate results. Code contributions are restricted while we audit for accuracy: see CONTRIBUTING.md.
MIT © NIMBLESITE PTY LTD.
