axm-ast
Python AST introspection CLI for AI agents, powered by tree-sitter.
What it does
axm-ast gives AI agents (and humans) instant, structured access to any Python codebase. One command and your agent knows every function, class, import, and dependency — no manual exploration needed.
Quick Example
$ axm-ast context src/mylib
📋 mylib
layout: src (16 modules, 151 functions, 9 classes)
python: >=3.12
🔧 Stack
cli: cyclopts models: pydantic tests: pytest
lint: ruff types: mypy packaging: hatchling
📦 Modules (ranked)
cli ★★★★★ (describe, inspect, graph, search...)
core.analyzer ★★★★☆ (analyze_package, build_import_graph...)
core.docs ★★★☆☆ (discover_docs, build_docs_tree...)
Features
- 🔬 Describe — Full package introspection with 4 detail levels + compressed AI mode + module filtering
- 📊 Graph — Import dependency visualization (text, Mermaid, JSON)
- 🔍 Search — Semantic symbol lookup by name, return type, kind, or base class
- 📞 Callers — Tree-sitter call-site detection: "who calls this function?"
- 📋 Context — One-shot project dump: stack, patterns, module ranking
- 💥 Impact — Change impact analysis: callers + graph + test mapping
- 💀 Dead code — Detect unreferenced symbols with smart exemptions (test callers, lazy imports, dict dispatch, entry points)
- 🔀 Diff — Structural branch diff at symbol level (added/modified/removed)
- 🏗️ Workspace — Multi-package workspace support (auto-detects
uvworkspaces) - 📖 Docs — One-shot documentation tree dump with progressive disclosure (toc/summary/full) and page filtering
- ⭐ Rank — PageRank-based symbol importance scoring
- 📄 Stub —
.pyi-like stub generation