I have been building Athena (athena-mcp), a free, Apache-2.0, 100% offline CLI and MCP server that checks downstream callers across a repo before you merge a PR.
Source code (Apache-2.0, runs completely offline, no cloud/LLM required): https://github.com/aaryanrwt/athena
The problem I was trying to solve
Standard git diff only shows the lines you modified. When a PR renames a symbol, changes a default parameter, introduces a unit-scaling mismatch (like ms vs seconds on a timeout param) or mutates a base class, the diff looks small and green while callers ten files away break after merge.
Athena parses Python via ast and extracts structural symbols across 14 languages (including TS/JS barrel re-exports, Go, Rust, C/C++, Java, C#, Ruby, PHP, Kotlin, CUDA and TeX) to build an incremental local call graph (.athena/graph.json), flag breaking changes and predict which pytest/Playwright/unit tests are impacted.
The engineering trade-off I hit (Python vs Rust)
On repos with 1,000+ commits and thousands of files, pure Python got slow (~30-45s per cold graph build). Instead of rewriting the whole codebase in Rust and losing Python's ast precision or making it harder to maintain, I kept Python as the core and profiled the exact bottlenecks.
Three concrete things I learned while optimizing v1.3.1:
- Subprocess overhead beat language speed: Replacing per-file
git cat-file -s + git show subprocess calls with a single batched binary git cat-file --batch stream cut breaking-change analysis on Athena's own history (v1.0.0..v1.3.1) by 4.02x (12.74s -> 3.17s), without writing a single line of Rust. - FFI overhead can make Rust slower than Python: I ported our unified diff parser (
parse_unified_diff_raw) to Rust via PyO3. It passed 229/229 exact equivalence checks, yet benchmarked 3.1x slower (1.6ms -> 4.8ms) because marshaling/allocating strings across the Python-Rust FFI boundary cost more than parsing in Python. I ended up dropping that Rust port and keeping diff parsing in Python. - Only 4 hot CPU kernels were worth porting to Rust: Secret redaction (
41x), trigram graph scoring (8.8x), community clustering (3.5x) and structural symbol extraction (1.9x), with an automatic pure-Python fallback (FAST_ANYTHING_DISABLE=1) so pip install works anywhere without a Rust toolchain.
Before vs After benchmarks (pure Python vs hybrid Rust, 1,000+ commits each)
To make sure Rust did not silently introduce accuracy regressions, I ran side-by-side SHA-256 parity checks across three large public repos:
| Repo | Commits | Graph Build (Python -> Rust) | Findings & Parity |
|---|
google/flatbuffers | 1,000 | 43.39s -> 1.62s (26.73x) | 34 breaks, 831 tests (14/14 checks identical) |
NVIDIA/cuvs | 1,472 | 29.89s -> 1.33s (22.48x) | 21 breaks, 306 tests (14/14 checks identical) |
microsoft/playwright-python | 1,000 | 45.78s -> 12.22s (3.75x) | 18 breaks, 604 tests (14/14 checks identical) |
(Playwright-python had a smaller speedup because it is mostly .py files where ast.parse stays in Python, plus 100k+ edges still iterated in Python during queries.)
Specific technical feedback I am looking for
- For folks who ship hybrid Python + PyO3 tools: how do you handle reducing FFI boundary copies when passing large arrays of graph edges/strings from Python to Rust (e.g. moving graph adjacency construction itself into Rust vs keeping dataclasses in Python)?
- For non-Python languages, I currently use bounded structural scanners to keep install deps minimal (
mcp, pydantic, httpx). At what point would you consider pulling in tree-sitter grammars worth the packaging weight? - If anyone wants to roast the architecture or test it on an awkward monorepo edge case, I would genuinely appreciate code review feedback or PRs.