Scan a Python codebase for identical, semantically equivalent, or cross-file duplicate functions.
Block a merge when two similar functions touch different systems such as production vs test databases.
Generate a dependency map and report before refactoring large legacy modules.
Keep a memory of past approval decisions so the same duplicate is not reviewed twice.
Pure Python prototype with a small CLI entry point and sample files; no external services required.
CodeTruth Agent V1 is a Python tool that looks for duplicate functions inside a Python codebase and decides whether merging the duplicates would actually be safe. The README frames it as a prototype rather than a production library, and positions it as an alternative to simpler duplicate detectors that only compare text or look at the structure of the code. The pipeline has seven stages. It scans Python files, parses them into an abstract syntax tree, compares functions for similarity, classifies the risk and any conflicts, runs an approval step that can block the merge, performs the merge with a backup of the original files, and finally writes a report including a dependency map. The README gives an example where two functions look almost identical, but one connects to a production PostgreSQL database and the other to a test MySQL database. The tool flags this as a business-rule conflict and blocks the merge, on the principle that the same structure does not always mean a safe merge. The README lists the detection capabilities, which include catching identical duplicates, functions with different names but the same logic, duplicates across files, recursion, and nested versus flat versions of the same code. Safety features include automatic backups before any change, a required human approval step, dependency tracking across files, and a learning memory that remembers past decisions so the user does not have to answer the same question again. A large section of the README is given over to a test scorecard. The author reports 22 test cases all passing, covering things like identical detection, semantic duplicates, false positive rejection, recursion, default argument conflicts, and a real-world run against a file from the requests library. The README also notes that the test scenarios themselves were drafted with help from several AI assistants, while the final implementation and validation were done by hand. The repository layout includes a main entry point and several sample Python files used by the tests. The README does not state a license.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.