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.7.9.tar.gz (54.1 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.7.9-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for archaeologist-0.7.9.tar.gz
Algorithm Hash digest
SHA256 f7deead54cbd055fd90ce88af360271a8d95efc476ef5423bb67ae4e40821c78
MD5 db5b628fd6297144ea4d92edef1b9bb0
BLAKE2b-256 ba7db0880afe4c9633be204aebc5d0c2ec6d7cb1c376ca69cbb1d7cb1270c5db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: archaeologist-0.7.9-py3-none-any.whl
  • Upload date:
  • Size: 59.6 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.7.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d87f5f70fdc871a2c8a6edc26613f317e582651bcc9b6b62f50ad377252ff603
MD5 2f205377bd3b3053b72ddeb6a5f5f969
BLAKE2b-256 e5cfe274c26c2b17913ac32365c64fc30e4a5f3e24ee1ee60f856a39491dabab

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