Fast AST-indexed code search CLI for 15 programming languages with native Rust implementation, designed for Claude Code / Cursor integration.
ast-index is a fast AST-indexed code search CLI for 15 programming languages, built with native Rust. It leverages tree-sitter for multi-language AST parsing and SQLite FTS5 for full-text indexing, enabling millisecond-level symbol search in large codebases.
Core Tech Stack
- grep-searcher (ripgrep core) for fast text search
- SQLite + FTS5 for full-text search index storage
- rayon for parallel file parsing
- tree-sitter for AST parsing across 12 languages
Key Features
Indexed Search Commands (requires ast-index rebuild first)
search- General symbol searchclass- Class/interface/protocol searchsymbol- Any symbol searchimplementations- Find implementations of interfaces/abstract classeshierarchy- Class inheritance treeusages- Symbol usage (reference points)
Grep-style Search Commands (no index required)
todo- TODO/FIXME/HACK commentscallers- Function call sitescomposables- @Composable functionsdeprecated- @Deprecated itemsinject- @Inject/@Autowired injection pointsannotations- Annotated classesextensions- Extension functionsflows- Flow/StateFlow/SharedFlow
Module Dependency Analysis
module/deps/dependents- Module and dependency relationshipsunused-deps- Unused dependencies (including transitive deps, XML, resource checks)api- Module public API
XML & Resource Analysis
xml-usages- Class usage in XML layoutsresource-usages- Resource usage and unused resource detection
iOS-specific Commands
storyboard-usages/asset-usages/swiftui/async-funcs/publishers/main-actor
Performance Benchmarks (~29k files, ~300k symbols large Android project)
| Command | ast-index | grep | Speedup |
|---|---|---|---|
| imports | 0.3ms | 90ms | 260x |
| dependents | 2ms | 100ms | 100x |
| deps | 3ms | 90ms | 90x |
| class | 1ms | 90ms | 90x |
| search | 11ms | 280ms | 14x |
| usages | 8ms | 90ms | 12x |
Performance Optimizations
- Batch indexing: 500 files chunked parsing and writing
- Thread pool limit: Max 8 threads for memory control
- Skip large files (> 1 MB) and long lines (> 2000 chars)
- SQLite cache: 8 MB
- Hardcoded directory exclusion: node_modules, pycache, build, dist, target, vendor, .gradle, Pods, DerivedData, etc.
Installation
# Homebrew (macOS/Linux)
brew tap defendend/ast-index
brew install ast-index
# Build from source
git clone https://github.com/defendend/Claude-ast-index-search.git
cd Claude-ast-index-search
cargo build --release
Claude Code Integration
claude plugin marketplace add defendend/Claude-ast-index-search
claude plugin install ast-index
Supported Languages Kotlin, Java, Swift, Objective-C, TypeScript, JavaScript, Rust, C#, Python, Go, C++, Scala, Ruby, Perl, Dart/Flutter, plus Protocol Buffers, WSDL/XSD
Project Info
- License: MIT License
- Latest Version: v3.20.0 (48 releases)
- Binary Size: ~4.4 MB