# Treepeat - Code similarity detection using Tree-sitter

Original title: Show HN: Treepeat – Code similarity detection using Tree-sitter

> Hacker News story 49804359 · language: en · submitted 2026-09-22
> Web version: https://zeli.app/story/49804359
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 65 · by [91awebsi](<https://news.ycombinator.com/user?id=91awebsi>) · 💬 8
[original](<https://github.com/dsummersl/treepeat>) · [HN discussion](<https://news.ycombinator.com/item?id=49804359>)

## Summary

Treepeat is a proof-of-concept tool that finds duplicate and near-duplicate code blocks in your codebase using Tree-sitter AST analysis and locality-sensitive hashing. It supports multiple languages including Python, JavaScript, Go, and Rust. With configurable rulesets (none, default, loose) and similarity thresholds, you can detect exact duplicates, ignore whitespace and strings, or find structurally similar code. Treepeat integrates into CI via SARIF output and offers side-by-side diffs for easy review.

## Key quote

> Find duplicate code blocks meaningful to the language (classes/functions), not just lines.

## HN discussion (8 comments)

### [ryuuseijin](<https://news.ycombinator.com/item?id=49836730>)

> This is what I wanted to help with duplicate code detection, which is now a real problem with agentic programming since the agent tends to duplicate helper functions a lot in bigger codebases.
>
> I ended up writing my own tool [1] that uses vector search, which works but can be unusably slow in large codebases.
>
> I will give this a shot.
>
> [1]: https://github.com/ninjaxtools/slopdex

### [adityamishra241](<https://news.ycombinator.com/item?id=49840497>)

> Nice approach. AST-level similarity seems much more useful than simple text matching.

### [Game_Ender](<https://news.ycombinator.com/item?id=49837505>)

> Thank you for a README that is readable.  It might have a bit of AI help but it’s concise and makes it clear how to use the tool.

---

## Cite

- Page: https://zeli.app/story/49804359
- Date: 2026-09-22
- Source: github.com (https://github.com/dsummersl/treepeat)
- Hacker News: https://news.ycombinator.com/item?id=49804359

## Other languages

- zh: https://zeli.app/zh/story/49804359 · markdown: https://zeli.app/zh/story/49804359.md
- ja: https://zeli.app/ja/story/49804359 · markdown: https://zeli.app/ja/story/49804359.md
- ko: https://zeli.app/ko/story/49804359 · markdown: https://zeli.app/ko/story/49804359.md
- de: https://zeli.app/de/story/49804359 · markdown: https://zeli.app/de/story/49804359.md
- es: https://zeli.app/es/story/49804359 · markdown: https://zeli.app/es/story/49804359.md
- ru: https://zeli.app/ru/story/49804359 · markdown: https://zeli.app/ru/story/49804359.md
