Back to directory

treepeat

A Python command-line tool that finds duplicate and near-duplicate code across a codebase using tree-sitter parsing and locality-sensitive hashing, with adjustable rules for how strictly two blocks must match.

treepeat

treepeat scans a codebase for similar or duplicate code blocks using tree-sitter AST analysis and locality-sensitive hashing. It supports three normalization rulesets: an exact mode that only ignores irrelevant syntax, a default mode that also ignores whitespace, strings and high-level node types such as function names, and a loose mode that anonymizes identifiers and constants to find structurally similar code.

It works across fifteen languages including Python, JavaScript, TypeScript, Go, Rust, Java and Kotlin, and its command-line flags control similarity percentage, minimum match length, diff display and output format, including a SARIF option for continuous-integration pipelines. A separate treesitter subcommand shows how source code is normalized into tokens, to help explain why two blocks were flagged as similar. It installs from PyPI and is an early-stage project that supports a limited set of languages so far.

More in Code quality

See all 94
  • Critic

    critic.run

    A code-change viewer, backed by Y Combinator, built for reviewing work written by coding agents, presenting a plain-language narrative of each change alongside the diff and a running conversation with the agent.

  • GitIntel

    hoangsonww.github.io

    An MCP server that computes git repository analytics such as hotspots, churn, temporal coupling, knowledge maps and risk scoring entirely from local commit history, for AI coding agents like Claude Code and Codex.

  • Axint

    axint.ai

    A verification layer for AI coding agents working on Apple projects: it runs real Xcode builds and tests against the Swift an agent wrote, reconciles static analysis findings against that evidence, and returns a signed proof with the exact repairs still needed.