Skip to main content

Find and auto-delete dead code across 9 languages — with git intelligence and auto PR

Project description

☠ Archaeologist

Codebase intelligence toolkit. Five tools to understand, clean, and improve your codebase — all from one install.

pip3 install archaeologist

Five Tools

☠ Unused Code Finder

Find functions nobody calls. Combines static analysis with git history into a confidence score. Auto-deletes on an isolated branch, runs your tests, and opens a GitHub PR.

deadcode ./my-project --explain
deadcode-report ./my-project --output report.html
deadcode-clean ./my-project --dry-run --min-confidence 85
deadcode-clean ./my-project --min-confidence 85

⬡ Codebase Graph

Interactive browser-based map of your architecture. Files grouped by folder, colored by health. See which files are clean, which have dead code, and which are completely unused.

archaeologist-graph ./my-project
archaeologist-graph ./my-project --output graph.html

◎ Change Impact Analyzer

Before changing any file, see what could break — every caller, every importer, test coverage, and a 0–100 blast radius score.

archaeologist-impact ./my-project user_service.dart
archaeologist-impact ./my-project user_service.dart --html

◈ Complexity Scorer

Scores every function on cyclomatic complexity — decision branches, nesting depth, and length. Ranks worst-first so you know what to refactor.

archaeologist-complexity ./my-project
archaeologist-complexity ./my-project --html --min-score 15

⧉ Duplicate Detector

Finds copy-paste code and near-identical functions. Detects same names in different files, exact body copies, and high-similarity implementations.

archaeologist-dupes ./my-project
archaeologist-dupes ./my-project --html

Languages

Production tested: Python, Dart/Flutter, JavaScript, TypeScript

Beta (may have false positives): Go, Java, Kotlin, Ruby, Rust, Swift


How the Unused Code Finder Works

  1. Parse — Tree-sitter builds an AST for every file, extracting all function definitions and calls
  2. Git analysis — Last commit date, author count, and commit frequency per file
  3. Score — Five signals combine into a 0–100 confidence score
  4. Delete — Functions removed by precise AST byte ranges — no broken syntax
  5. Test — Your test suite runs automatically. If tests fail, everything rolls back
  6. PR — A GitHub PR opens with full documentation of every change

Confidence Score Signals

Signal Points How it works
Call graph 45 Zero callers = full 45pts
Git age 20 2+ years untouched = 20pts
Author count 15 Single author = 15pts
Recursive dead 10 All callers are also dead = 10pts
Commit count 10 Only 1–2 commits ever = 10pts

Verdicts

  • 80–100: Safe to remove — Multiple signals agree. Auto-clean targets these by default.
  • 50–79: Review first — Likely unused. Verify manually before removing.
  • 40–49: Needs runtime data — Static analysis uncertain. May be called via reflection.

Git Flow (Auto-clean)

Your main branch is never touched. Everything happens on an isolated branch:

  1. New branch created — e.g. cleanup-2026-05-28
  2. Functions removed surgically by AST byte ranges
  3. Your test suite runs automatically
  4. If tests pass — branch committed
  5. GitHub PR opened with full documentation
  6. If tests fail — branch deleted, nothing changes

To review and merge:

git checkout cleanup-2026-05-28
git diff main cleanup-2026-05-28
git checkout main && git merge cleanup-2026-05-28

To roll back:

git branch -D cleanup-2026-05-28

Requirements

  • Python 3.11+
  • Git (for git history analysis)
  • GitHub token (optional, for auto-PR feature)

License

MIT — free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archaeologist-0.9.1.tar.gz (59.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

archaeologist-0.9.1-py3-none-any.whl (64.3 kB view details)

Uploaded Python 3

File details

Details for the file archaeologist-0.9.1.tar.gz.

File metadata

  • Download URL: archaeologist-0.9.1.tar.gz
  • Upload date:
  • Size: 59.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for archaeologist-0.9.1.tar.gz
Algorithm Hash digest
SHA256 c27cffae4856507de1c76d791205ac2562c1eaa62b7ea60ab3a2216afe98c830
MD5 08e96f819b52871d79fa646991927e94
BLAKE2b-256 030b516be5b8d07f8572314caba559cabc9358d4dec3ccdacd0e4ddd1cbc2031

See more details on using hashes here.

File details

Details for the file archaeologist-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: archaeologist-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 64.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for archaeologist-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81dc69bdcb48660515de173d0aa429f88ca1538fca9ee8d92ef3dd0dcbf79185
MD5 7c9511960d157a0a1653e47b82e4eacc
BLAKE2b-256 6d0041640ff6456dd32dda17d3d28cdf5bc5ba0c48d47b3477ce3eaaa4e7a56d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page